Templates

If you look at the earlier stylesheet examples in this chapter, you will notice that the majority of the information contained in the stylesheets themselves is contained in elements called templates, which take the following form:

<xsl:template match="description"> 
 <i><xsl:value-of select="."/></i>
 <br/>
</xsl:template>

The “xsl:” is simply the Namespace prefix that identifies the element as part of the XSL Stylesheet Namespace.

The template itself consists of two major parts—the first is the match attribute, which makes use of an XPath pattern to specify the component being selected by the template for transformation. The second part is the content, or body, of the template, which is where the transformation information is specified. ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.