SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
Standards Conformance
Extensibility
Saxon Extensions
Sample Saxon Applications
| Introduction
| Knight's Tour
| JAXP Transformation Examples
| SaxonServlet
| The Book List Stylesheet
| Shakespeare Example
| The Bible
» | JDOM Example
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
XSLT Patterns

# JDOM Example

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

To use this facility:

- The JAR file saxon-jdom.jar must be on the classpath

- JDOM must be installed and on the classpath

- You must be using JDK 1.4 or later.

The sample application JDOMExample.java illustrates how a JDOM tree can be used with Saxon. It combines two scenarios: running XPath expressions directly against a JDOM tree, from the Java application; and invoking a transformation with the JDOM 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 JDOM tree, modifies it in situ to add extra attributes, and then references these attributes from the stylesheet.