[jdom-interest] problems applying XSL transform to JDOM

Mattias Jiderhamn mj-lists at expertsystems.se
Mon Aug 14 23:32:15 PDT 2006

At 2006-08-15 00:22, wkrick at eio-online.com wrote:
>I'm using JDOM 1.0 with Java 1.4.2.
>I'm trying to use the method shown here to apply an XSL transform to
>my JDOM document...
>It appears to get stuck in a loop and hangs on this line...
>xmlOutputter.output(sourceDoc, sourceOut);
>... no exceptions are thrown.
>Has anyone else used the method illustrated at the link above and
>gotten it to work?

No. Seems overly complicated to me.

>Is there an easier way?  Basically, I have a JDOM Document object in
>my application, I want to apply an XSL transform and write out the XML
>result to a file.

   TransformerFactory factory = TransformerFactory.newInstance();
   Transformer transformer = factory.newTransformer( new 
StreamSource(xslFile) );

   JDOMSource xmlSource = new JDOMSource(document);
   StreamResult result = new StreamResult(outputFile);

   transformer.transform(source, result);

More information about the jdom-interest mailing list