# About SAXON

version 6.5.4

Contents |
On this page | On other pages
What is SAXON? Installation Technical Support Historical Note | Conditions of Use Changes in this release Using XSL Stylesheets XSL Elements XPath Expression syntax Pattern syntax Standards Conformance SAXON Extensions Extensibility mechanisms Java API Overview Sample applications

Version 6.5.4 clears a number of bugs found in Saxon 6.5.3 in the two years since it became available. It also updates the build to enable it to work with JDK 1.5 (also known as J2SE 5.0). This version of Saxon implements XSLT 1.0 and XPath 1.0. It is unrelated to Saxon version 8.x, which implements the XSLT 2.0 and XPath 2.0 specifications. For details of all current Saxon versions, see http://saxon.sf.net/.

See here for details of changes in this release.

.

Although Saxon 6.5.x has proved highly stable, there was demand for a maintenance release that incorpated published fixes. This release is produced by Michael Kay of Saxonica Limited, with generous support from Crane Softwrights Limited, specialists in XML, XSLT, and XSL-FO training.

There are no plans for further development or maintenance releases on this branch of the Saxon development: all new developments take place in Saxon 8.x. Saxon 8.x comes in two forms, a basic XSLT 2.0 and XQuery processor (Saxon-B) available as an open source product from SourceForge, and a schema-aware XSLT 2.0 and XQuery processor (Saxon-SA) available as a commercial product from Saxonica Limited.

## What is SAXON?

The SAXON package is a collection of tools for processing XML documents. The main components of Saxon 6.5.x are:

- An XSLT processor, which implements the Version 1.0 XSLT and XPath Recommendations from the World Wide Web Consortium, found at http://www.w3.org/TR/1999/REC-xslt-19991116 and http://www.w3.org/TR/1999/REC-xpath-19991116 with a number of powerful extensions. This version of Saxon also includes many of the new features that were first defined in the XSLT 1.1 working draft, but for conformance and portability reasons these are not available if the stylesheet header specifies `version="1.0"`.
- A Java library, which supports a similar processing model to XSL, but allows full programming capability, which you need if you want to perform complex processing of the data or to access external services such as a relational database
- A slightly improved version of the Ælfred parser originally written by David Megginson, then of Microstar. (But you can use SAXON with any SAX-compliant XML parser if you prefer).

So you can use SAXON by writing XSLT stylesheets, by writing Java applications, or by any combination of the two.

SAXON is particularly useful when converting XML data into other formats. The output format may be XML, or HTML, or some other format such as comma separated values, EDI messages, or data in a relational database.

SAXON implements the XSLT 1.0 recommendation, including XPath 1.0, in its entirety. SAXON also provides some XSLT 1.1 features, in particular:

- Support for multiple output files using xsl:document. (Saxon was the first processor to provide this feature, which has now found its way into the latest W3C working draft. The xsl:document element replaces the saxon:output instruction offered in previous releases. The implementation of xsl:document at this time is not 100% compliant with the draft XSLT 1.1 specifications).
- It allows multi-pass processing, by allowing result-tree-fragments to be used in any context where a node-set can be used. (The saxon:node-set() extension function is still available, but it is now superfluous.)
- It supports XML Base, a facility which allows the base URI of an element to be defined using an xml:base attribute.

Note that the XSLT 1.1 working draft was subsequently abandoned. Most of the new functionality (with the exception of Java and Javascript language bindings) reappeared in the XSLT 2.0 drafts, but in some cases with different syntax.

In addition, Saxon provides an extensive library of extension elements and extension functions, all implemented in conformance with the XSLT 1.0 standard to ensure that portable stylesheets can be written. These include the EXSLT extension libraries common, sets, math, dates-and-times, and functions. Many of these extensions were pioneered in Saxon and have since become available in other products.

Saxon also includes a number of powerful extension functions that go beyond EXSLT. Most of these rely on the concept of "stored expressions" as an additional data-type: this allows an XPath expression to be constructed at run-time from a string, and allows an expression to be passed as an argument to a function (which in effect provides higher-order functions). This allows:

- distinct() to provide grouping capability on any calculated value
- sum(), min() and max(), of any calculated value
- expression() and evaluate() to allow an XPath expression to be constructed dynamically, passed to the stylesheet as a parameter, or read from the source document.

As a Java class library, SAXON gives you the ability to use the XSLT rule-based approach to document processing, but with the flexibility of the full Java language. You can declare handler classes to match particular patterns in the document, and can process arbitrary sets of nodes selected using XPath expressions. This provides a high-level query capability which you can mix with purely navigational access.

## Historical Note

SAXON is essentially a one-man project: I have done almost all the development myself, except for a small number of routines which I "borrowed" from other open source products, and a few add-ons contributed by users.

I originally wrote SAXON to support an internal project in ICL (now part of Fujitsu), and ICL continued to sponsor development of SAXON until my departure from the company in January 2001. However, it was never a supported ICL product. I then worked for, Software AG for three years: they continued to sponsor the development of SAXON, but again without making it a corporate product. There is no remaining connection with ICL or Software AG, though its origins in ICL are reflected in package names and URLs. In early 2004 I set up a company, Saxonica Limited to continue the development and support of Saxon on a commercial basis, and Saxonica is responsible for this maintenance release. The software is available entirely without support or warranty, and with no commitments to any future releases.

The name SAXON was chosen because originally it was a layer on top of SAX. Also, it uses the Ælfred parser (among others); Ælfred of course was a Saxon king...

Please read the Conditions of Use.

## Technical Support

Saxon comes with no warranty and no formal technical support service.

If you have questions, however, you can usually get an answer by raising them on the Saxon discussion list at http://lists.sourceforge.net/lists/listinfo/saxon-help.

Once registered, you can post messages to saxon-help@lists.sourceforge.net.

If you hit something that looks like a bug, please check the known errors on the Saxon project pages at SourceForge. Also check the list archives.

If the query relates to the XSLT/XPath language rather than Saxon itself, it is better to use the XSL-list: check first that the query isn't already covered in the FAQ. Another useful site for XSLT information is www.xslinfo.com

## Installation

Existing users please see the file changes.html for details of incompatible changes in this release.

The full SAXON distribution includes source and object code, documentation, and sample applications. You don't need to touch the source code unless you need to make changes.

Object code is issued as a JAR file, saxon.jar, which you must include on your class path. Under JDK 1.3 or earlier you also need saxon-xml-apis.jar on your class path.

Saxon 6.5.3 includes a built-in XML parser, but you can use it with a different XML parser if you wish. To do this from the command line, specify the required parser using the -x or -y options; from the Java API, set the name of the parser class as an attribute of the TransformerFactory object.

User documentation, covering both the XSLT and Java interfaces, is included in the download in the form of extensive javadoc specifications. Be sure to read the package summaries, which give an overview in the form of a user guide. In addition there is an introductory overview.

### Prerequisites:

#### Java JDK dependencies

Saxon 6.5.4 as released is compiled under JDK 1.3, and will run with any version of the JDK from JDK 1.2 to JDK 1.5 inclusive. However, there are slightly different constraints for different versions of the JDK, as noted below.

##### JDK 1.2 and JDK 1.3

This version of the JDK does not include SAX or DOM interfaces as standard, nor does it include JAXP. It is therefore necessary to include freestanding SAX2, DOM3, and JAXP1.1 (or higher) implementations on the classpath. For convenience all the required classes have been placed into a JAR file `saxon-xml-apis.jar`.

There are several ways you can invoke Saxon from the command line:

- Option 1: Set the CLASSPATH environment variable to contain both `saxon.jar` and `saxon-xml-apis.jar`, and then run Saxon using the command `java com.icl.saxon.StyleSheet source.xml stylesheet.xsl`

- Option 2: Specify an explicit CLASSPATH by running Saxon using the command `java -cp saxon.jar;saxon-xml-apis.jar com.icl.saxon.StyleSheet source.xml stylesheet.xsl`

If you want to make full use of Saxon's DOM interfaces under JDK 1.2 or JDK 1.3, you will also need a freestanding DOM implementation on your classpath. Saxon has been tested using Xerces 2.6.2: with this product, you need `xercesImpl.jar` and `xml-apis.jar` on the classpath.

##### JDK 1.4 and JDK 1.5

These Java versions include DOM, SAX, and JAXP as standard. Therefore, the JAR file `saxon-xml-apis` is not required. Saxon can be run from the command line using any of the approaches below:

- Option 1: Run Saxon using the command `java -jar saxon.jar source.xml stylesheet.xsl`

  Note that the -jar option causes the classpath to be ignored. This means that it's not possible to use this approach when the stylesheet invokes extension functions, or when it uses an XML parser other than the default AElfred parser supplied with Saxon.

- Option 2: Set the CLASSPATH environment variable to contain `saxon.jar`, and then run Saxon using the command `java com.icl.saxon.StyleSheet source.xml stylesheet.xsl`

- Option 3: Specify an explicit CLASSPATH by running Saxon using the command `java -cp saxon.jar com.icl.saxon.StyleSheet source.xml stylesheet.xsl`

If you need to recompile Saxon, please note that the source code refers to classes that are present only in DOM Level 3, which is included in JDK 1.5. If you are compiling under JDK 1.5, this should cause no difficulty; however, code compiled under JDK 1.5 will not run under an earlier JDK. If you recompile Saxon under an earlier JDK, you will need to have DOM3 interfaces on your classpath. Source code definitions of the necessary interfaces are included with the Saxon source code; you should ignore these if running under JDK 1.5.

#### JDOM

SAXON has an option to work with a source tree constructed using JDOM. SAXON 6.5.4 is validated with JDOM version 1.0; it may not work with earlier releases.

#### XML Parsers

SAXON 6.5.4 comes with a bundled XML parser, a modified copy of the Ælfred parser, adapted to notify comments to the application. SAXON has been tested successfully in the past with Xerces, Lark, SUN Project X, Crimson, Oracle XML, xerces, xml4j, and xp. Use of a SAX2-compliant parser is preferred, as SAX1 does not allow XML comments to be passed to the application. However, SAXON works with either. All the relevant classes must be installed on your Java CLASSPATH.

#### Editors and Development Tools

Because Saxon is run from the command line, you might find it useful (under Microsoft Windows) to have a text editor with better command-line support than the standard DOS window. I use UltraEdit, shareware available from www.ultraedit.com; many people use the open source `jEdit` editor available from http://www.jedit.org/.

Saxon is well-supported by development tools. Some of the products available are:

- Stylus Studio
- oXygen
- XML Spy
- Exchanger XML Editor

### Download

An index of all current versions of Saxon is on the home page at http://saxon.sourceforge.net/. Older versions can be loaded from the SourceForge download page.

Michael H. Kay
Saxonica Limited
22 June 2005