XSLT
Publisher: O'Reilly Media
Released: August 2001
Pages: 480

XSLT documents a core technology for processing XML. Originally created for page layout, XSLT (Extensible Stylesheet Transformations) is now much more: a general-purpose translation tool, a system for reorganizing document content, and a way to generate multiple results-- such as HTML, WAP, and SVG--from the same content.

What sets XSLT apart from other books on this critical tool is the depth of detail and breadth of knowledge that Doug Tidwell, a developer with years of XSLT experience, brings to his concise treatment of the many talents of XSLT. He covers XSLT and XPath, a critical companion standard, and addresses topics ranging from basic transformations to complex sorting and linking. He explores extension functions on a variety of different XSLT processors and shows ways to combine multiple documents using XSLT. Code examples add a real-world dimension to each technique.

Useful as XSLT is, its peculiar characteristics make it difficult to get started in, and the ability to use advanced techniques depends on a clear and exact understanding of how XSLT templates work and interact. For instance, the understanding of "variables" in XSLT is deeply different from the understanding of "variables" in procedural languages. The author explains XSLT by building from the basics to its more complex and powerful possibilities, so that whether you're just starting out in XSLT or looking for advanced techniques, you'll find the level of information you need.

Table of Contents
Product Details
About the Author
Colophon
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyXSLT
 
3.9

(based on 8 reviews)

Ratings Distribution

  • 5 Stars

     

    (2)

  • 4 Stars

     

    (3)

  • 3 Stars

     

    (3)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

Reviewed by 8 customers

Sort by

Displaying reviews 1-8

Back to top

(1 of 1 customers found this review helpful)

 
4.0

Both tutorial and reference

By Doug Domeny

from Undisclosed

Comments about oreilly XSLT:

First half of the book is more of a learning tutorial where you have to wade through the examples that don't work to get to the completed example at the end. The second half of the book is an excellent reference.

 
4.0

Example obscured by detail

By Mike Webster

from Undisclosed

Comments about oreilly XSLT:

I found this book far more helpful than Learning XSLT however I have to agree with the comment that the amount of code listed gets in the way some times.

For example, I was interested in finding out how to use extensions in Xalan, which is covered, but the example went off to describe some Javascript featured in the XSL or document to be tranformed which was not related to this subject. I believe the information I needed was in there somewhere, but I eventually looked it up on Google and went to an IBM page on the subject to get some clarity.

I do appreciate having full examples in places. I find many programmers err on the other side of things and show you an example without context which is usually not terribly helpful either.

It wasn't just me by the way, the person I was working with saw the Javascript mentioned and immediately said "No, we're working with Java, not Javascript, this isn't what we want." I had to get them to read several pages before they agreed this section covered what I claimed it covered.

(0 of 1 customers found this review helpful)

 
4.0

XSLT

By Stuka

from Undisclosed

Comments about oreilly XSLT:

Reviewer: Stuka

The book: XSLT

ISBN: 0-596-00053-7

Review URL: http://usalug.org/phpBB2/viewtopic.php?t=4622

Reviewed for USA Linux Users Group

Website: http://www.usalug.org

Book link: http://www.oreilly.com/catalog/xslt/

Sample chapter: http://www.oreilly.com/catalog/xslt/chapter/ch05.html

XSLT:

Being a big fan of only doing work once, the premise of XSLT, the Extensible Stylesheet Language for Transformations, is an irresistible draw – create your data once, in a well-defined XML format, then use XSLT to transform the data into various formats, including HTML, PDF, or any arbitrary (possibly proprietary) protocol.

Doug Tidwell's XSLT: Mastering XML Transformations is an excellent way to quickly dive into XSLT. Tidwell starts off with some basics – what XSLT is, why it's useful, what tools can be used with it, and how to get a basic XSLT processing system up and running. Chapter 2, appropriately titled "The Obligatory Hello World Example", contains what its name indicates, along with a thorough walk-through of how the stylesheet and XML document are processed by the XSLT tools. Tidwell then provides several more XSLT variations on the Hello, World theme, converting the same XML file into HTML (the original example), PDF, VRML, SVG, and even a Java Hello World program.

Next up is a study of XPath, the language used to choose specific elements within an XML document. Chapter 3 tells you how to pick out elements, attributes, or whatever other bits of info you need to properly transform your XML into the desired target format.

Chapter 4 is probably the most interesting, as it covers all the branching, conditional logic, and other control-flow statements and techniques of XSLT transformations. This section is particularly critical for programmers steeped in procedural languages, as XSLT owes much of its nature to the functional programming paradigm. Tidwell makes thorough use of examples to show you how to do all the things you might need, from simple if/then branches, to recursive emulations of the popular for loop we've all written a million times. Explicitly calling templates, and passing parameters to them, is also covered, adding new forms of flexibility to the stylesheets you can create.

Chapters 5 through 7 go deeper into the advanced functionality of XSLT, covering the automatic creation of links and cross-references, sorting and grouping data, and combining multiple input documents into a single output document respectively. As with previous chapters, Tidwell gives thorough examples, and walks through them carefully, so that you can really see how to make these features work to your advantage.

Extending the XSLT engines, and utilizing extensions other developers have added, and what to do if the extension you want is unavailable, consume chapter 9. Tidwell shows how to use various extensions to connect to a database, edit JPEG graphics files, and create SVG pie charts on the fly using extensions already created for the Xalan and Saxon XSLT processors.

The final 'real' chapter of this in-depth examination of XSLT is a case study of the Toot-O-Matic, which Tidwell developed for IBM's developerWorks site. This tool takes a tutorial, created in a standard XML format, and creates 4 different versions of it for various audiences – an online HTML version, 2 PDF versions (letter and A4 sized), and a .zip version for offline perusal. The HTML version also has common navigation elements, and other niceties you'd expect from a website with ibm.com in the URL, so studying the Toot-O-Matic is an excellent way to see a lot of really fancy techniques in action.

The final third or so of the book contains reference material for XSLT, XPath, and the functions available for them – invaluable material for use in an ongoing fashion.

All in all, Doug Tidwell's XSLT is an excellent book for someone with a decent programming background, a base knowledge of XML, and a desire to learn XSLT. It's very fast-paced, and very hands-on, with lots and lots of XSLT code to read and learn from. With this book, and a set of XSLT tools (many of which are readily pointed out by the author), you'll be up and running in the XSLT world in no time flat.

 
5.0

XSLT Review

By Gan Uesli Starling

from Undisclosed

Comments about oreilly XSLT:

Excellent book! Just what I was looking for. I'd been wanting to re-write my how-tos for NetBSD. But the markup for HTML put me off. Armed with this book and naught else, in no time at all I wrote for myself in XML/XSLT a how-to for re-doing my other howtos. The same stylesheet will be used throughout. I'm no guru, so for me this is ultra cool! Here is the link.

http://starling.ws/XML/howto.xml

 
3.0

XSLT Review

By Neil Milne

from Undisclosed

Comments about oreilly XSLT:

Reasonably good, but very focused towards transforming XML for HTML targets. I was new to XSLT and found that the numerous mistakes in the example stylesheets a bit confusing and annoying, and spent some time scratching my head over what the second grouping example was doing (until realizing that the first sorted for-each contains superfluous sorts from first and last name, which can be removed since the second and third example [using id's] appear functionaly identical - they both select sorted 'zip' code elements and then sort a selected subsets of the data by name, they just do it slightly differently).

The XSLT reference in the back is quite handy, but I'd perhaps recommend another primer if you want to do XML->XML translation, as many of the functions you'd use aren't explored in the tutorial-like section of the book. For example, the copy and copy-of elements aren't talked about at all until the dry reference section! Based on some of the feedback about the XML technology O'Reilly books in general it sounds like they could do with some more thorough newbie and peer proof reading...

 
3.0

XSLT Review

By Ben

from Undisclosed

Comments about oreilly XSLT:

IMHO, this is currently (3-7-2002) the best resource available for learning XSLT in depth.

I would comment however that the title should be "Xalan XSLT". The author does mention in the preface that he doesn't care which XSL tools you use so long as they are standards compliant ... but a lot of the examples use Xalan-specific extensions, without much guidance on using any other XSL processors. I would suggest that if he is encouraging use of any standards compliant XSL processor that his code and examples should also work with any compliant processor, not just Xalan. Don't get me wrong, it's a good book, but being that I am avoiding using Java and sticking with the C++ based XSL tools it was a little dissapointing to see so many exapmles that only use Java classes. I have sinced figured out how to do most of the stuff I wanted with libxml2 and libxslt via other resources on the web.

(1 of 2 customers found this review helpful)

 
5.0

XSLT Review

By Donald W. Larson

from Undisclosed

Comments about oreilly XSLT:

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

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)

Java source code

Virtual Reality Modeling Language (VRML)

Portable Document Format (PDF) using Formatting Objects (XSL-FO)



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

Element

Attribute

Text

Comment

Processing instructions

Namespace



XPath has several uses:



Location paths

Setting the context for evaluation

Relative and Absolute Expressions that return resultant sets or empty sets if the conditions are not fully met

Wildcard features

Axes



Abbreviated

Unabbreviated



Predicates

Attribute Value Templates

Datatypes



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



http://xml.apache.org/fop/

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

http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html

http://www.ibiblio.org/xml/books/bible2/chapters/ch18.html

http://www-106.ibm.com/developerworks/library/x-xslfo/?n-x-11151



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/

(1 of 1 customers found this review helpful)

 
3.0

XSLT Review

By karthik

from Undisclosed

Comments about oreilly XSLT:

This is in my opinion is a good book on XSLT. It teaches the basics and then some advanced stuff as well. I especially liked the XSLT reference (the latter half of the book) with examples of how to use the XLST features, functions etc.

The only complaint i have is that the book lists the entire code and they run for pages! :-(. I find it to be very distracting.

It was better to just show a few code snippets to highlight a partcular point and the reader c'd anyway use the code listing available in downloadable format in the oreilly web site.

Hope the author will cover more meaty stuff in the 2nd edition probably and avoid such big code listings.

Displaying reviews 1-8

Back to top

 
Buy 2 Get 1 Free Free Shipping Guarantee
Buying Options
Immediate Access - Go Digital what's this?