O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

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

Building the Style Sheet

Now that we've got the basics down, let's start building our style sheet. The style sheet we'll use to process our XML document is actually an XML document itself, so let's start with the root element, as shown in Listing 2.2.

Listing 2.4. catalog.xsl: The Most Basic Style Sheet
1: <?xml version="1.0"?>
2: <xsl:stylesheet>
3: </xsl:stylesheet>

There's not a lot to this style sheet. In fact, it has only two items, really: the processing instruction on line 1 to tell the program (in this case, the browser) that this is an XML document, and the root element, <xsl:stylesheet>.

That root element, though, is something new. The xsl: part is to tell the browser that there's something special about this tag; it's not part of ...

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