Buy it now
One Minute Bottom Line
|A terrific effort that might not be an "I've never done this before" introduction, but will certainly have a place on your bookshelf if you work with XSLT with any regularity!|
Chapter 1 - Getting Started
Before you can do anything with XSLT, you have to understand the basics of XML. These are briefly mentioned here, as are several of the specifications relevant to and supporting XSLT. Also discussed are installation processes for the XSLT processors discussed and exemplified in the book: for XSLT 1.0 only, Xalan-J, Xalan-C, the Microsoft .NET framework, and the MSXSL processor; for XSLT 2.0, Saxon (especially Saxon-B, which excludes schema support and some performance improvements found in Saxon-SA, the commercial version) and the XSLT engine from Altova's XML Spy. These are released under a variety of licensing terms; links to explore are given below.
Chapter 2 - The Obligatory Hello World Example
From a very simple XML document (courtesy of the XML 1.0 specification, no less!) come several output versions from different stylesheets that demonstrate clearly the separation between content and presentation that XSLT enables.
Chapter 3 - XPath: A Syntax for Describing Needles and Haystacks
A key to XSLT is understanding XPath, the language used to designate items to be worked on in XML source documents. The structure of an XML document as seen by XPath 1.0 is explicated, followed by the changes and additions in the XPath 2.0 specification. Since the changes are very significant between XSLT (and XPath) 1.0 and 2.0, the titles of the sections of the book dealing with 2.0 are prefaced with "[2.0]", which makes it easy to identify which to go to or to skip, depending upon your processor. Datatypes and operators in XPath are covered in some detail, as are the differences between "basic" and "schema-aware" XSLT 2.0 processors.
Chapter 4 - Creating Output
At this point, we begin exploring the most basic of XSLT elements, <xsl:text> and <xsl:value-of>. These elements, formatting elements, and use of <xsl:copy> and <xsl:copy-of> make up the bulk of the coverage, which is clearly aimed at generating text quickly. A section on controlling whitespace concludes this initial discussion.
Chapter 5 - Branching and Control Elements
If only there were never decisions to be made! However, in real life, decisions are always before us: all programming languages have to deal with them and XSLT is no exception. XSLT parameters and variables are presented, as is the use of recursion, something central to XSLT 1.0 development but often obviated by the changes in XSLT and XPath 2.0.
Chapter 6 - Creating Links and Cross-References
A key to information these days is linking it to other information for a variety of reasons (pointing to explanations, to more detail, to fuller treatment, etc.). A datum without a link is a lonely player indeed in the world of Web 2.0. Using the XML ID, IDREF, and IDFREFS datatypes and the XSLT key() and generate-id() functions to provide output with references to other data is covered.
Chapter 7 - Sorting and Grouping Elements
Closely related to linking data is sorting and grouping it; the idea of organizing data is common to both. Sorting and especially grouping are much changed in XSLT 2.0, but coverage of the Muench method for grouping items in XSLT 1.0 is included.
Chapter 8 - Combining Documents
Not only data is related to other data in this world, but documents are frequently related to other documents. XSLT provides the ability to combine documents using the document() function, but this is only the beginning: information may have to be sorted, grouped, or linked across multiple documents. XSLT 2.0 simplifies the process, but the XSLT 1.0 way to accomplish such tasks is also presented.
Chapter 9 - Extending XSLT
References to and overviews of XSLT, XPath, XQuery Functions, XML Schema, XSLT formatting codes, and a guide to migration to XSLT 2.0 make up the appendices. This material is perhaps not meant for reading so much as for reference. As such, however, they are invaluable, and probably constitute the real value of the book.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)