JDOM2 Example

This section applies to the Java platform only. Requires Saxon-PE or Saxon-EE

Saxon includes an adapter that allows the source tree to be a JDOM2 document.

To use this facility JDOM2 must be installed and on the classpath.

The sample application JDOM2Example.java illustrates how a JDOM2 tree can be used with Saxon. It combines two scenarios: running XPath expressions directly against a JDOM2 tree, from the Java application; and invoking a transformation with the JDOM2 document supplied as the Source object.

The application is designed to take two arguments, the books.xml file in the samples/data directory, and the total.xsl file in the samples/styles directory. The application builds a JDOM2 tree, modifies it in situ to add extra attributes, and then references these attributes from the stylesheet.