JDOM2 example
SaxonJ includes an adapter that allows the source tree to be a JDOM2 document. 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.