[jdom-interest] XML and XSL

Laurent Bihanic laurent.bihanic at atosorigin.com
Mon Aug 20 03:26:24 PDT 2001


Ian Lea wrote:

> Take a look at jdom-b7/samples/XSLTransform.java.  Send the result
> out to the browser from a servlet using something along the lines of
> 
>   out.output(doc2, res.getWriter());


That won't work if the output is HTML as you can not build a JDOM document 
from HTML content (because it's not well-formed XML).

XSLTransform.java is a good way to start for how to allocate a XSLT processor.
But if you want just plain XML to HTML conversion, skip JDOM and the 
JDOMSource/Result and use a plain StreamSource for feeding the XML to the XSLT 
processor and a StreamResult to get the HTML as text directly on the servlet 
response stream.

Laurent




More information about the jdom-interest mailing list