Transform an XML Document with a Command-Line Processor

Perform XSLT transformations at the command line.

A good number of free XSLT processors are available for transforming XML on the command line. I’ll introduce some possible choices here: Michael Kay’s Saxon written in Java (http://saxon.sourceforge.net), Apache’s Xalan written in C++ (http://xml.apache.org/xalan-c/), and Microsoft’s MSXSL, also written in C++ (search for MSXSL on http://msdn.microsoft.com). Xalan is written in both Java (http://xml.apache.org/xalan-j/) and C++, but I’ll be covering only the C++ version.

Saxon

You can use Saxon in the regular Java version (saxon8.jar) or as Instant Saxon, which is a Windows executable (saxon.exe).. Both are available at http://saxon.sourceforge.net. The latest (and probably last) release of Instant Saxon is Version 6.5.3, which came out in August 2003. The latest release of the regular Saxon is Version 8.0. It is likely that a more recent version of Saxon will be available after this book goes to print, as Saxon’s development is keeping up with drafts of XSLT 2.0 and XPath 2.0. Both Instant Saxon and Saxon are free, and Saxon is open source, although you can also now purchase a commercial version from Saxonica.

Saxon was the first spec-compliant XSLT 1.0 processor and was released 17 days after the XSLT 1.0 and XPath 1.0 recommendations were published in 1999. Saxon’s creator, Michael Kay, is the editor of the XSLT 2.0 specification and one of the editors for XPath 2.0.

Instant ...

Get XML Hacks 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.