Installing Saxon

As of this writing, the most complete open source XSLT 2.0 stylesheet processor is Saxon. Written by Michael Kay, the editor of the XSLT 2.0 spec, it is available at http://saxon.sourceforge.net. When you download the file (currently saxonb9-0-0-2j.zip), add saxon9.jar to your CLASSPATH. There are also nine other files, saxon9-ant.jar, saxon9-dom.jar, saxon9-dom4j.jar, saxon9-jdom.jar, saxon9-s9api.jar, saxon9-sql.jar, saxon9-xom.jar, saxon9-xpath.jar, and saxon9-xqj.jar. These .jar files enable additional functions; see the Saxon documentation for more information about them. For most of what we’ll do in this book, saxon9.jar is all you’ll need.

Once you’ve installed Saxon and updated your classpath, go to a command prompt and type the following command:

java net.sf.saxon.Transform

You should get a message like this:

No source file name Saxon 9.0.0.3J from Saxonica Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html Options: -a Use xml-stylesheet PI, not style-doc argument -c:filename Use compiled stylesheet from file -cr:classname Use collection URI resolver class -dtd:on|off Validate using DTD -expand:on|off Expand defaults defined in schema/DTD -explain[:filename] Display compiled expression tree -ext:on|off Allow|Disallow external Java functions -im:modename Initial mode -it:template Initial template -l:on|off Line numbering for source document -m:classname Use message receiver class -o:filename Output file or directory -or:classname Use ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.