Preface
Extensible
Stylesheet Language Transformations (XSLT) is a powerful technology for transforming
XML
documents into other useful forms, but
it is sometimes considered difficult to learn. Its template-based
approach makes it a prime candidate for learning by example, and XSLT
examples are often easily repurposed. XSLT 2.0 greatly increases the
power and elegance of XSLT but also increases its complexity.
When I first began working with XSLT (and again when learning XSLT
2.0), I longed for a cookbook that would accelerate my productivity
by providing ready-made solutions to the challenges I faced. My first
experience with such a book was
O'Reilly's Perl
Cookbook. This book was more influential to my reluctant
learning and ultimate appreciation of Perl than the original camel
book (Programming Perl) by Larry
Wall. I believe
cookbooks are important because most software developers are not
satisfied with simply figuring out how to make something work: they
are interested in mastering the technology and using the best-known
techniques, and they want answers fast. There is no better way to
master a subject than by borrowing from those who have already
discovered better ways to do things.
Longing for a cookbook soon turned into a desire to write one,
especially since I collected several useful recipessome that
were developed by others and some that I created. However, I did not
want to write an XSLT book simply packaged in an alternate form; I
wanted to provide a useful resource that also highlighted some
less-obvious ways to apply XSLT. In the process, I hoped to attract
XML developers who have not yet been motivated to learn XSLT and who,
in my opinion, are missing out on one of XML's best
productivity tools. If you are one of these folks who has not yet
experienced XSLT, please bear with me for a few more paragraphs while
I pitch the value of XSLT and the role of this book in helping you
realize its potential.
XSLT is a language that lives simultaneously on the fringes and in
the mainstream of current software-development technology. While
working on the first edition of this project, I often found myself
explaining to friends what XSLT was and why it was important enough
to spend time writing a whole book about it. These same friends had
heard of Java, Perl, and even XML, but not XSLT. I also observed an
increasing number of requests for XSLT assistance on XSLT mailing
lists and more industry attention in the form of books, articles, and
sophisticated XSLT development tools. The XSLT user base is clearly
growing daily; however, many software professionals and technology
enthusiasts do not understand what it is and why it is important.
With the release of new XSLT 2.0 implementations, I hope adoption of
XSLT will accelerate, but this is not certain, partly due to
competition from XQuery 1.0 and other XML manipulation methodologies.
One thing is certain: mastering XSLT 2.0 is a worthwhile endeavor
because its use will certainly increase, even if it never explodes.
Further, learning XSLT will give you a deeper insight into XML
processing even if you favor an alternative solution.
Although XSLT 1.0 is a mature language and XSLT 2.0 is not far
behind, I would still guess that more that half of all companies and
individuals working with XML do not use XSLT. Not so long ago, a
colleague who is otherwise well-versed in all the latest technologies
described XSLT as just another styling language. This
misunderstanding is forgivable because XSLT advertises itself through
the first three words in its name (Extended Stylesheet Language) and
with the keyword that begins most XSLT programs
(xsl:stylesheet). However, the last word in the
XSLT
acronym, Transformations, is what makes XSLT so
important and is what drew me to the language in the first place. One
of my goals in writing this book is to show how XSLT is relevant to a
wide variety of problems. I also want to provide both novice and
intermediate users of XSLT a one-stop shopping place for some of the
most commonly requested XSLT techniques. Finally, I want to push the
envelope of what one can do with XSLT so current users can go even
further and the unconvinced can join the fold of highly productive
XML transformers.
Over the years, I have heard many sweeping statements about computer
science. Opinions like, "All computation is simply
fancy bit manipulation," "Computers
are really just sophisticated number crunchers," or
"Everything a computer does can be understood in
terms of symbol manipulation" are true to some
extent. However, I would like to make a sweeping generalization of my
own: "Every problem we solve with software can be
understood in terms of transformations." Mastery of
computer science is mastery of transformation. Transformation is what
CPUs do, it is what algorithms do, and it is what software developers
do. And transformation is what XSLT does, at least when the input is
XML (and sometimes when it is not). Of course, XSLT is not the only
transformational game in town, and as with the thousands of languages
that came before it, it is unclear whether it will evolve as an
independent language or be absorbed into the next
"big thing." What is clear is that
the ideas behind XSLT will not go away because many of these ideas
are as old as computer science itself. This book helps the reader
master and apply these ideas to specific problems.
|