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

Templates

Absolutely everything in XSLT is based on one element: the template. Templates are used to decide what elements should be output, and how. Although most applications have built-in templates, which makes it difficult to learn the basics, the Working Draft version of IE5 does not, which makes it easier for us to get a feel for what's happening. For the benefit of those using the older namespace, and because it won't hurt anything, we'll duplicate those built-in templates.

The most basic template is shown in Listing 2.7.

Listing 2.7. catalog.xsl: The Basic Template
0:<?xml version="1.0"?>
1:<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2:
3:<xsl:template match="/">
					4:         <xsl:value-of select="."/>
					5:</xsl:template> ...

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