|What is Instant SAXON?|
Writing a stylesheet
Running a stylesheet
Conditions of Use
|A D V E R T I S E M E N T||For comprehensive information about using XSLT|
see my book
XSLT Programmers Reference
published by Wrox Press
Version 6.4.3 clears a number of bugs; you will find these listed on the project page at http://sourceforge.net/projects/saxon
Instant SAXON is a cut-down version of the full SAXON package. It provides an XSLT processor that can be executed directly on Windows 95/98/NT/2000 platforms. It includes the same executable code as full Saxon, but omits source code, API documentation, and sample applications.
Note: the name "Instant" was originally chosen for two reasons: ease of download and installation, and execution speed. The advantage in execution speed arose because a packaged executable was much faster to load than a conventional Java archive. This is no longer true; in fact, Saxon runs up to three times faster using Sun's JDK 1.3 Java VM than it does with the Microsoft Java VM. For high performance, the full Saxon product, run under JDK 1.3, is therefore recommended.
The XSLT processor is a complete implementation of the W3C XSLT 1.0 specification from the World Wide Web Consortium, found at http://www.w3.org/TR/1999/REC-xslt-19991116 (including the associated XPath syntax) with a number of powerful extensions
You need a machine running Windows (95, 98, NT, or 2000), with the Microsoft Java Virtual Machine. The Java VM will already be installed if you use Internet Explorer 4 or later; if it is not, you can download it free from Microsoft.
Some problems have been reported running previous versions of Saxon with older versions of the Microsoft Java VM. The typical symptom is that your transformation produces a blank output file, or sometimes that sections are missing from the output. If this happens, try upgrading to a later version of the Java VM: you can do this simply by clicking Tools / Update Windows from the IE5 menu bar.
You will need an unzip utility such as WinZIP.
Because the product is run from the command line, you might find it useful to have a text editor with better command-line support than the standard DOS window. I use Programmer's File Editor (PFE), a free product available from a number of download sites, for example softseek.com. Another suitable product (available as shareware) is UltraEdit.
No other software is required. Instant SAXON comes with a bundled XML parser, the AElfred parser from Microstar. This version of Aelfred has been modified to support the SAX2 interface and to fix known errors.
Download the file instant-saxonVVV.zip (400 Kb) to a convenient directory. You will find an index of the available versions of this file on the Saxon home page.
Unzip the file into the directory from which you intend to execute it, e.g. c:\saxon
It contains two files: saxon.exe, which is the XSLT processor, and instant.html, which is a copy of the HTML page you are reading.
The syntax for stylesheets is exactly the same as for the full SAXON product. It is described in the following pages:
For more advanced functionality, such as writing your own extension functions, or embedding Saxon within an application, please see the documentation that comes with the full SAXON package.
The SAXON XSLT interpreter is designed to be run from the command line:
saxon [options] source.xml style.xsl [ params ]
The options must come first, then the two file names, then the params. The stylesheet is omitted if the -a option is present.
The options are:
|-a||Use the xml-stylesheet processing instruction in the source document to identify the stylesheet to be used. The style-doc argument should be omitted. Stylesheets embedded within the source document are not supported at this release.|
|-ds | -dt||Selects the implementation of the internal tree model. -dt selects the "tinytree" model (the default). -ds selects the traditional tree model.|
|-l||Switches line numbering on for the source document. Line numbers are accessible through the extension function saxon:line-number(), or from a trace listener.|
|-m classname||Use the specified Emitter to process the output from xsl:message. The class must implement the com.icl.saxon.output.Emitter class. This interface is similar to a SAX ContentHandler, it takes a stream of events to generate output. In general the content of a message is an XML fragment. By default the standard XML emitter is used, configured to write to the standard error stream, and to include no XML declaration. Each message is output as a new document.|
|-r classname||Use the specified URIResolver to process all URIs. The URIResolver is a user-defined class, that extends the com.icl.saxon.URIResolver class, whose function is to take a URI supplied as a string, and return a SAX InputSource. It is invoked to process URIs used in the document() function, in the xsl:include and xsl:import elements, and (if -u is also specified) to process the URIs of the source file and stylesheet file provided on the command line.|
|-o filename||Send output to named file. In the absence of this option, output goes to standard output. The file extension of the output file is used to decide the default output method if none is specified.|
|-t||Display version and timing information to the standard error output|
|-T||Display stylesheet tracing information to the standard error output. Also switches line numbering on for the source document.|
|-TL classname||Run the stylesheet using the specified TraceListener. The classname names a user-defined class, which must implement com.icl.saxon.trace.TraceListener|
|-u||Indicates that the names of the source document and the style document are URLs; otherwise they are taken as filenames, unless they start with "http:" or "file:", in which case they are taken as URLs|
|-w0, w1, or w2||Indicates the policy for handling recoverable errors in the stylesheet: w0 means recover silently, w1 means recover after writing a warning message to the system error output, w2 means signal the error and do not attempt recovery. (Note, this does not currently apply to all errors that the XSLT recommendation describes as recoverable). The default is w1.|
|-x classname||Use the specified SAX parser for source file and for any files loaded using the document() function. The parser must be the fully-qualified class name of a Java class that implements the org.xml.sax.Parser or org.xml.sax.XMLReader interface|
|-y classname||Use the specified SAX parser for all stylesheet files, including any loaded using xsl:include or xsl:import. The parser must be the fully-qualified class name of a Java class that implements the org.xml.sax.Parser or org.xml.sax.XMLReader interface|
|-?||Display command syntax|
A param takes the form name=value, name being the name of the parameter, and value the value of the parameter. These parameters are accessible within the stylesheet as normal variables, using the $name syntax, provided they are declared using a top-level xsl:param element. If there is no such declaration, the supplied parameter value is silently ignored.
You can specify a parameter value containing spaces by enclosing it in double quotes, for example name="John Brown"
If the -a option is used, the name of the stylesheet is omitted. The <?xml-stylesheet?> processing instruction must have a pseudo-attribute href that identifies the relative or absolute URL of the stylsheet document, and a pseudo-attribute type whose value is "text/xml", "application/xml", or "text/xsl". For example:
<?xml-stylesheet type="text/xsl" href="../style3.xsl" ?>
The full SAXON distribution includes source and object code, documentation, and sample applications.
You will find it at http://saxon.sourceforge.net/
SAXON is free. Please see the conditions of use.
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 firstname.lastname@example.org.
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
Michael H. Kay
13 July 2001
Personal home page: http://users.iclway.co.uk/mhkay