View Review Details


Book:   XSLT
Subject:   XSLT Review
Date:   2002-02-27 09:58:28
From:   Donald W. Larson
Rating:  StarStarStarStarStar

XSLT


Paperback, First Edition, August 2001, 473 pages


By Doug Tidwell


© Copyright 2001 by O'Reilly & Associates, Inc.


ISBN 0-596-00053-7


Review written February 24, 2002


By Donald W. Larson, O'Reilly Book Evangelist


Email: dwlarson@sd.znet.com


Web Site: http://www.timeoutofmind.com/index.html


MacOS 9.1 Sample Code for most of the book's examples is available ready to run using JBindery 2.2 here.


Preface


The book's examples and majority of explanations depend on Apache's Xalan-J XSLT engine with conforming XML parsers, such as Xerces2 Java Parser. Other parsers and processors are briefly addressed.


Chapter 1


This chapter explains the fundamentals of XSLT and XML, including DTD's and Schema's. The author takes the time to break down the fundamentals into easily understood sections, explaining the pros and cons concerning many of the fundamentals.


Examples from the book are available online so that the reader can follow along. Each example is placed in the appropriate Chapter folder and easily identified by page number mapped to its name.


At the end of the chapter, the last page carefully explains how to download the Xalan-J Parser and install it properly. All the examples in the book will work with Xalan-J. I used Xalan-J and Xerces to run my examples on my Macintosh under MacOS 9.1 and MRJ 2.2.5.


Chapter 2


This chapter provides a sample xml file and some variations in stylesheets that illustrate the typical, "Hello World", example file.


The XSLT Processor is explained and discussed as a tree representation of the xml data.


Each step in the transformation process from xml via stylesheet to the resultant output is explained thoroughly. Nodes of the XSLT tree and the elements of the processing are described clearly using XPath components as needed.


A gallery of four other stylesheet transformations is illustrated to render xml to:



  • Scalable Vector Graphics (SVG)</li>


  • Java source code</li>


  • Virtual Reality Modeling Language (VRML)</li>


  • Portable Document Format (PDF) using Formatting Objects (XSL-FO)</li>



Chapter 3


This chapter explains the syntax of XPath, used to describe parts of an xml document:


XPath views the xml as a set of tree nodes. Each of the below nodes is explained clearly with a sample example xml file including an embedded DTD:



  • Root</li>


  • Element</li>


  • Attribute</li>


  • Text</li>


  • Comment</li>


  • Processing instructions</li>


  • Namespace</li>



XPath has several uses:



  • Location paths</li>


  • Setting the context for evaluation</li>


  • Relative and Absolute Expressions that return resultant sets or empty sets if the conditions are not fully met</li>


  • Wildcard features</li>


  • Axes</li>



    • Abbreviated</li>


    • Unabbreviated</li>



  • Predicates</li>


  • Attribute Value Templates</li>


  • Datatypes</li>



A sample stylesheet is provided at the end of the chapter that will transform an xml file into a nested series of html tables for viewing in your browser. That styesheet is very comprehensive and covers most of the subject matter in this chapter.


Chapter 4


This chapter conveys information about branching, passing parameters, and using variables. There are a couple example stylesheets that create new stylesheets as a result! Various programming techniques are mentioned to facilitate dynamic transformations.


Chapter 5


This chapter was read very slowly. J It explains in detail the way XSLT uses links and cross-references so that elements of xml files can be referred in database-like ways. XSLT Extension functions are demonstrated for the reader. Keys and how to generate dynamic keys is explained.


Chapter 6


This chapter covers the ordering of transformations using sort and grouping elements.<xsl:key> is used via the "Muench method" shows another way to group xml elements.


Chapter 7


Chapter seven examines the ways to combine xml documents. Various ways are employed to take one xml file and transform it into several other resulting files. It also details using various xml source files and creating one new output file. There is some more coverage of the sorting and grouping techniques explained in Chapter 6.


Chapter 8


There are times when the default transformation handling is not sufficient for your needs. Chapter 8 covers the ground for adding external functionality, using Java and JavaScript. The Saxon Processor is briefly discussed too. Creating JPEG's and how to access a database is described.


Chapter 9


The author, Doug Tidwell, is the author of the IBM developerWorks web site tutorial product, "Toot-O-Matic". Doug explains the source code that drives Toot-O-Matic and makes it easy top create web-based tutorials. I personally have benefited from Doug's other contributions on IBM's developerWork's site that implements Toot-O-Matic.


Using Toot-O-Matic exercises your entire understanding of this book. I will be looking at it in the many months to come.


Appendices A; B; C; and D


The book contains four appendixes with examples for each particular element or function of XSLT, XPath. That in itself is a very important toolset!


Glossary and Index


Very nicely done.


General Book Comments


I appreciate the time it takes to write a book when the very technologies one writes about is changing rapidly. Doug has done a very good job explaining the titles XML technology with very descriptive narrative and excellent examples. I look forward to more of Doug's writings in print and online.


I found this book to be an excellent learning reference. I only found three examples that did not run as expected. I tried several times to get in touch with the author to ask for some assistance, but I never reached him. In any case, the examples indeed illustrate the technologies very well.


Rating: 9.5 out of 10 This rating is my own personal value system and as such is very subjective. I think a rating of 5 means I would read finish reading a book. A rating of 10 would indicate I had trouble putting a book down and have no complaints at all about it.


Macintosh Source Code Examples Online


MacOS 9.1 Sample Code for most of the book's examples is available ready to run using JBindery 2.2 here. You will need to download and install the Xerces and Xalan tools from Apache XML Project to run these examples. See that link page for more instructions. Using the double-clickable JBindery 2.2 applications allows the Macintosh-Java novice to explore XML and XSLT easily. :-)


These same MacOS X double-clickable examples may appear as I find time to create them. Occasionaly check my new site, Time Out Of Mind for availability and location.


Don's Supplementary Resources


Below are additional sources to help anyone learn more about these technologies.


XSLT Tutorial


http://zvon.org/xxl/XSLTutorial/Books/Book1/index.html


XSLT Reference


http://zvon.org/xxl/XSLTreference/Output/index.html


XSL Formatting Objects


http://www.dpawson.co.uk/xsl/sect3/bk/index.html


XML Validation


http://www-106.ibm.com/developerworks/features/xmlvalidatorform.html


Formatting Objects (XSL-FO). FOP is the world's first print formatter driven by XSL formatting objects. It is a Java application that reads a formatting object tree and then turns it into a PDF document. The formatting object tree can be in the form of an XML document (output by an XSLT engine like XT or Xalan) or can be passed in memory as a DOM Document or (in the case of XT) SAX events.



XML Pointer Language (XPointer). XPointer, which is based on the XML Path Language (XPath), supports addressing into the internal structures of XML documents and external parsed entities. It allows for examination of a hierarchical document structure and choice of its internal parts based on various properties, such as element types, attribute values, character content, and relative position.


http://www.w3.org/TR/xptr/


XML Linking Language (XLink). This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe links similar to the simple unidirectional hyperlinks of today's HTML, as well as more sophisticated links.


http://www.w3.org/TR/xlink/



See larger cover
Browse within this book