O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Simple XSL Style Sheet

The best way to get a feel for how XSL style sheets work is to see one in action. Listing 23.1 shows an XML file describing two people. Notice the <?xml-stylesheet?> processing instruction that specifies the name of the XSL style sheet that accompanies this XML file.

Code Listing 23.1. Source Code for Person.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="PersonToHTML.xsl"?>
<people>
    <person>
        <firstName>Samantha</firstName>
        <middleName>Lauren</middleName>
        <lastName>Tippin</lastName>
        <age>7</age>
    </person>
    <person>
        <firstName>Kaitlynn</firstName>
        <middleName>Dawn</middleName>
        <lastName>Tippin</lastName>
        <age>4</age>
    </person>
</people>
					

Listing 23.2 shows the PersonToHTML.xsl style sheet that translates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required