With a sound foundation in XML theory behind you, it's now time to address the other half of the jigsaw - actually converting all that marked-up data into something useful. This first article in a two-part series examines the need, rationale and basic concepts of XSLT, the Extensible Stylesheet Language for Transformations, with sample code and examples.
If you've been paying attention over the last few weeks, you should now have a pretty clear idea of what XML is all about, together with some insight into its capabilities and lexical rules. You should clearly understand the difference between elements and attributes, between CDATA and PIs, and between In fact, if I've done my job right, you should be so excited about XML that you've spent the past two weeks converting your entire address book, desk calendar and stock portfolio into XML-compliant markup...
Keep in mind, though, that marking data up in XML is only half the battle; the other half involves using that XML data for something constructive (displaying a neatly-formatted list of addresses and phone numbers, highlighting those stocks which have shrunk to 10% of their original value, and so on.) However, XML is simply a tool to describe data; you can't use it to affect layout or presentation and, in fact, you shouldn't even attempt to, since one of XML's original design goals was to separate data from its presentation.
Obviously, then, there needs to be some other way to present marked-up XML data. And there is - XML's sister technology, XSLT, or Extensible Stylesheet Language Transformations. Over the course of this tutorial, I'm going to explain how XSLT works, together with a few simple (and not-so-simple) examples of how you can use it to get the most out of your XML data. Keep reading!