XSL Processors

In programming on 12月 5, 2004 at 4:05 上午

DocBook XSL:The Complete Guide

Chapter 2. XSL processors

An XSL processor is the software that converts an XML file into formatted output. There is a growing list of XSL processors to choose from. Each tool implements parts or all of the XSL standard, which actually has several components:

The XSL Standards

Extensible Stylesheet Language (XSL)
A language for expressing stylesheets written in XML. It includes the XSL formatting objects (XSL-FO) language, but refers to separate documents for the transformation language and the path language.

XSL Transformation (XSLT)
The part of XSL for transforming XML documents into other XML documents, HTML, or text. It can be used to rearrange the content and generate new content.

XML Path Language (XPath)
A language for addressing parts of an XML document. It is used to find the parts of your document to apply different styles to. All XSL processors use this component.

To publish HTML from your XML documents, you just need an XSLT processor. It will include the XPath language since that is used extensively in XSLT. To get to print, you need an XSLT processor to produce an intermediate formatting objects (FO) file, and then you need an XSL-FO processor to produce PostScript or PDF output from the FO file. A diagram of the DocBook Publishing Model is available if you want to see how all the components flow together.

XSLT processors

Currently there are three processors that are widely used for XSLT processing because they most closely conform to the XSLT specification:

Saxon was written by Michael Kay, the author of XSLT Reference, one of the best books on XSLT. Saxon is a free processor written in Java, so it can be run on any operating system with a modern Java interpreter. It uses the Aelfred XML parser internally, which has some bugs, so many people substitute the Xerces parser.

Xalan is part of the Apache XML Project. It has versions written in both Java and C++, both of them free. The Java version is described in this book because it is highly portable and more fully developed. Generally Xalan is used with the Xerces XML parser (Java or C++), also available from the Apache XML Project.

The xsltproc processor is written in C by Daniel Veillard. It is free, as part of the open source libxml2 library from the Gnome development project. It is considered the fastest of the processors, and is highly conformant to the specification. It is much faster than either of the Java processors. It also processes basic XIncludes.

There are a few other XSLT processors that should also be mentioned:

James Clark’s XT was the first useful XSLT engine, and it is still in wide use. It is written in Java, so it runs on many platforms, and it is free. XT comes with James Clark’s nonvalidating parser XP, but you can substitute a different Java parser.

Microsoft’s MSXML engine includes an XSLT processor. It is reported to be fast, but only runs on Windows.

Sablotron, written in C++, from Ginger Alliance.

4XSLT, written in Python, from FourThought LLC.


Fill in your details below or click an icon to log in: 徽标

您正在使用您的 账号评论。 注销 /  更改 )

Twitter picture

您正在使用您的 Twitter 账号评论。 注销 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 注销 /  更改 )

Connecting to %s