Examples from Chapter 14 of The XML Bible, XSL Transformations
Listing 14-1:
An XML periodic table with two elements, hydrogen and helium
Listing 14-2:
An XSL style sheet for the periodic table with two template rules
Listing 14-3:
The HTML produced by applying the style sheet in Listing 14-2 to the XML in Listing 14-1
Listing 14-4:
The style sheet of Listing 14-2 adjusted to work with Internet Explorer 5.0
Listing 14-5:
An XSL style sheet that recursively processes the children of the root
Listing 14-6:
An XSL style sheet with one rule for the root node
Listing 14-7:
Templates applied to specific classes of element with select
Listing 14-8:
An XSL style sheet that selects the UNITS attribute with @
Listing 14-9:
An XSL style sheet that selects only those ATOM elements whose STATE attribute has the value GAS
Listing 14-10:
A style sheet that outputs only those elements with known melting points
Listing 14-11:
A table of melting point vs. atomic numbers
Listing 14-12:
A table of melting point vs. atomic number using the abbreviated syntax
Listing 14-13:
A style sheet that numbers the atoms in the order they appear in the document
Listing 14-14:
An empty XSL style sheet
Listing 14-15:
An XSL style sheet that strips comments from a document
Listing 14-16:
A stylesheet that copies only ATOM elements that have MELTING_POINT children
Listing 14-17:
An XSL style sheet that counts atoms
Listing 14-18:
An XSL style sheet that sorts by atomic number
Listing 14-19:
An XSL style sheet that uses modes to format the same data differently in two different places
Listing 14-20:
An XSL style sheet embedded in an XML document
Copyright 1999, 2000
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified June 16, 2000