Templates and Template Rules

Templates are the individual statements you’ll use to create a transformation. A collection of templates are grouped together into what’s called a template rule. Listing 2.2 contains just one template rule. This begins with

<xsl:template match="/"> 

and ends with the closing tag

</xsl:template> 

This template rule is called the root template rule, because it processes the root element of the source document (see Listing 2.1). All style sheets must contain a root template rule. Later, you’ll learn how you can add other template rules to process additional elements from the source document.

Template rules contain a match attribute that specifies which element or elements you are processing. The root template rule’s ...

Get Special Edition Using XSLT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.