REVIEW - XSLT


Title:

XSLT

Author:

Doug Tidwell

ISBN:

Publisher:

O'Reilly (2001)

Pages:

460pp

Reviewer:

David Nash

Reviewed:

February 2002

Rating:

★★☆☆☆


I had high hopes for this book, coming as it does from the O'Reilly stable and I wasn't disappointed. I wasn't sure whether the book was going to be a tutorial or a reference on the subject of XML Stylesheet Language Translations, but it turned out to be both.

The book is divided into nine chapters, covering various aspects of XSLT and its use, followed by four appendices, the first three of which take over 200 pages and form a reference to XSLT and XPath (a notation used with XSLT to locate parts of an XML document).

The first chapter starts in the usual way, introducing the subject and also giving an overview of XML and the related standards to fill in any gaps in the reader's knowledge. I would expect however that most readers of this book would already be familiar with XML, if not the Document Object Model and some of the other standards referenced. It also introduces Xalan Java XSLT processor from the Apache project, which is used for the rest of the book when examples of transformations are given.

Chapter two is called 'The Obligatory Hello, World Example' and presents such an example by way of a gentle introduction to XSLT and its capabilities. It does this well. Not only does it show how to produce HTML, but also how to create a Scaleable Vector Graphics file, a PDF file, a Java program and even a VRML 3D virtual reality definition from the same simple Hello World XML input document.

Next up is chapter three, where XPath is described. This is a notation for defining paths to specific elements or sets of elements in XML documents, used extensively in XSLT to define elements used in transformations.

The next four chapters cover more advanced topics including branching, linking, sorting and combining multiple documents. All are described well, with plenty of examples. It becomes clear that XSLT is much more than a simple macro-like language than it may appear at first sight. In fact it supports the kind of recursion and compile-time programming that is demonstrated by Alexandrescu and the other proponents of advanced C++ template programming (this shouldn't put anyone off though, since it is not necessary for simple translations and in any case is explained well).

Chapter eight is about extensions and covers using extensions provided with the different XSLT processors, introducing Saxon as well as the by-now-familiar Xalan. It also shows how to provide your own extensions using Java and Jython, a Java implementation of the Python scripting language.

Chapter nine takes the form of a case study of a real-life application developed by the author and used on the IBM developerWorks web site. It covers a number of topics used in the book, showing how they can all come together.

As stated above, the rest of the book is reference material. The XSLT part (appendix A) includes plenty of detail with examples for each XSLT element and shows requirements, syntax and how to use each feature. Appendix B describes all the XPath node types, functions (node tests), datatypes and operators and together with Appendix C, which contains descriptions of all the XSLT and Xpath functions, with examples, it forms an XPath reference. There is also a guide to XSLT in the form of an FAQ list and finally a glossary.

I checked the index for coverage of XSLT elements, using the W3C standard as my reference and found that the only top-level XSLT elements that do not have an entry in the main text are decimal-format, attribute and attribute-set. These do all have entries in the appendix however, with extensive example code. There are also a number of other XSL elements that only have entries in the reference, but since the main part of the book before the reference is only a tutorial I would not necessarily expect to see every possible keyword there. It would have been a far greater crime to omit entries from the reference section.

If I had any other criticisms it would be the lack of C++, although the primary programming language used in the book is of course XSLT. Therefore it is reasonable for the author to choose one implementation of an XSLT processor (the Xalan Java one) to use for most of his examples, so this is not a real criticism --and at least it has curly brackets! He does give a few listings in other languages, for instance there are fragments of JavaScript used throughout when web pages are being generated.

In conclusion, I found this an excellent book and would recommend it both as a tutorial and as a reference. I was particularly impressed by the amount of example material in the reference section, since many such books simply include a terse description and syntax overview.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.