[jdom-interest] XML - XSL Transformations

Richard Forster rforster at melbpc.org.au
Sat Oct 16 18:16:11 PDT 2004

Hello JDOM.

I have encapsulated the XSLTransform utility included as a contrib with 
JDOM in a JavaBean to make life a little simpler for my beginning 
students. Maybe some others could find this useful.

 For those who haven't used it, XSLTransform demonstrates how to convert 
an XML document to whatever you like with XSL.  The actual transform 
method in my 'XSLTransformBean' is called getHTMLfromXML() 'cos that's 
my students do, but of course you aren't limited to HTML as output.

Here is a brief method summary.

 void     setDocument(Document doc)
          Set a JDOM Document to be transformed
 void     setStyleFile(String styleFile)
          Set the file name of an XSL stylesheet to use
 void     setStyleURL(String styleURL)
          Set the URL of an XSL style sheet to use
 void     setXMLFile(String xmlFile)
          Set the file name of an XML file to be transformed.
 void     setXMLURL(String xmlURL)
          Set the URL of an XML file to be transformed
String     getHTMLfromXML()
          Do the XML to HTML translation and return the HTML as a String

Note that several of these methods are alternatives - you will either 
want to transform a document OR a file OR a URL

The source code is downloadable from


and there is extended documentation at


You want, you take.

And thankyou for empowering my students with JDOM!

Richard Forster
Swinburne University

More information about the jdom-interest mailing list