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