O'Reilly logo

XML Hacks by Michael Fitzgerald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required