XML technologies / XSLT / XSLT Cookbook

(Excerpt from “XSLT Kochbuch” by Sal Mangano)

Extensible Stylesheet Language Transformations (XSLT) is a powerful technique for transforming XML documents into other useful forms, but is sometimes considered hard to learn. Its template approach makes it ideal for learning by example, and XSLT examples are often simply adapted and reused. XSLT 2.0 makes XSLT more powerful and elegant, but also more complex.

When I started using XSLT, and again when learning XSLT 2.0, I wanted a cookbook to improve my productivity with ready-made solutions to the problems I encountered. My first experience of such a book was O’Reilly’s Perl Kochbuch. It influenced my reluctant learning and eventual appreciation of Perl more than Larry Wall’s original camel book (Programmieren mit Perl). Cookbooks matter because most developers want more than merely making something work: they want mastery, established techniques and quick answers. There is no better way to master a subject than learning from those who have already discovered better ways to do things.

Wanting a cookbook soon became wanting to write one, especially after collecting useful recipes, some from others and some my own. I did not want simply to repackage an XSLT book, but to provide a useful resource highlighting less obvious applications. I hoped to reach XML developers who had not yet felt motivated to learn XSLT and were missing a major XML productivity tool. If you are new to XSLT, bear with me for a few paragraphs while I explain its value and this book’s role in helping you recognize its potential.

XSLT stands both at the edge and at the center of current software development. While writing the first edition, I often had to explain to friends what it was and why it merited an entire book. They had heard of Java, Perl and even XML, but not XSLT. Meanwhile, requests for help on XSLT mailing lists increased, as did industry attention through books, articles and sophisticated tools. The user base grows almost daily, yet many professionals and enthusiasts do not understand its importance. I hope new XSLT 2.0 implementations accelerate adoption, though competition from XQuery 1.0 and other XML methods makes this uncertain. Mastering XSLT 2.0 is nevertheless worthwhile as its use will grow. Learning it also deepens your understanding of XML processing even if you prefer another solution.

Although XSLT 1.0 is mature and 2.0 nearly so, I estimate that over half the companies and people using XML do not use XSLT. Recently, a colleague otherwise familiar with modern techniques dismissed it as just another fashionable language. This is understandable: the first three words in its name (Extended Stylesheet Language) and the keyword beginning most programs (xsl:stylesheet) suggest this. But its last word, Transformations, makes XSLT important and first attracted me to it. I wanted to show its ability to solve many problems and give beginners and occasional users the most requested techniques. Finally, I want to exploit its full potential so current users can advance and the unconvinced can join the community of highly productive XML transformers.

Over the years I have heard sweeping claims about computing: “Everything in computers is clever bit manipulation”, “Computers are really sophisticated number crunchers”, or “Everything a computer does is symbol manipulation”. Each is partly true. Here is my own generalization: “Every problem we solve with software can be expressed as a transformation.” Mastering computing means mastering transformations. CPUs transform things, algorithms do, and developers do too. So does XSLT, at least for XML input, and sometimes even otherwise. It is not the only transformer, and, as with thousands of earlier languages, its future as an independent language or part of the next big thing is uncertain. Its ideas will survive, however: many are as old as computing itself. This book helps readers understand and apply them to specific problems.

   

   

 

 

 

back to top