Chapter 10
XSLT: An Overview
Examples
- Example 10-1
- Example 10-2
- Example 10-3
- Example 10-4
- Example 10-5
- Example 10-6
- Download all chapter 10 code (chapter10.zip)
XSLT is one of the three parts of XSL (the other two are XPath and XSL-FO). The purpose of XSLT is to provide a way to translate an XML document into another XML documentfor example, transforming a MathML document into XHTML so it can be viewed over the Web.
XSLT allows you to comb through an XML document and do a number of things: copy existing elements, modify existing elements, or introduce entirely new elements altogether. XSLT accomplishes with by creating a series of rules, called template rules, that are applied to the source XML document. XSLT then creates a separate, new XML document after it applies all of the rules to the source.
Only one template rule is run automatically by XSLT. That main rule must contain references to all the other rules that are to be run.
There are many different functions and instructions you can use in XSLT. There are too many to list here, but they're all in the book!