In this chapter you will get started with XSLT by developing two stylesheets. In the first stylesheet you'll see how to generate an XHTML web page from an XML document.
The second stylesheet illustrates how to transform one XML data format to another, in this case from the Atom 1.0 syndication format to RSS 1.0.
You'll learn about:
Key XSLT elements and structure
Built-in template rules
XPath expressions for matching and selection
Different ways to invoke a stylesheet processor
Probably the most common application of XSLT is to generate one or more pages of a website from an XML source of some kind. For example, you might want to split a large file into chapters, each with a separate page, or display a news feed.
There are a couple of ways to accomplish this: You might want to rely on a browser's client-side processor to transform the content; alternatively, you could generate static content for a server to render.
Let's start with an example that relies on a browser's built-in processor. It is drawn from the case study that you will work on later in this book.
The case study in Chapter 11 illustrates the production of a website from a set of XML source documents that describe each of the XSLT elements and functions. The same information was used to produce the XSLT Quick Reference in Appendix C.
If you haven't already done so, download the source code for this book from this book's web page at
www.wrox.com. You'll ...