Wiley Beginning XSLT and XPath: Transforming XML Documents and Data 978-0-470-47725-0 Benutzerhandbuch

Produktcode
978-0-470-47725-0
Seite von 24
Williams
c01.tex
V3 - 07/31/2009
2:53pm
Page 1
1
F irst Steps with XSLT
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
Transforming an XML Document to a Web
Page
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 doc-
uments that describe each of the XSLT elements and functions. The same information was used to
produce the XSLT Quick Reference in Appendix C.
COPYRIGHTED MATERIAL