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