version 5.3.2
Contents |
What is Instant SAXON? Installation Writing a stylesheet Running a stylesheet Conditions of Use Full SAXON |
A D V E R T I S E M E N T | For comprehensive information about using XSLT see my new book XSLT Programmers Reference published by Wrox Press |
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.
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.
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.
No other software is required. Instant SAXON comes with a bundled XML parser, the AElfred parser from Microstar. The parser has been modified to support the SAX2 interface so that it notifies comments to the stylesheet processor.
Download the file instant-saxon.zip (250 Kb) to a convenient directory.
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 the file 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, please see the documentation that comes with the full SAXON package.
The SAXON XSL 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. |
-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 | |
-u | Indicates that the names of the source document and the style document are URLs; otherwise they are taken as filenames |
-x classname | Use specified SAX parser for source file and 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 specified SAX parser for stylesheet file, 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://users.iclway.co.uk/mhkay/saxon/index.html
SAXON is free. Please see the conditions of use
.Michael H. Kay
12 May 2000
Personal home page: http://users.iclway.co.uk/mhkay