3.2. Built-in Template Rules

Template rules use the match attribute to select nodes from the input XML document to be processed. However, XSLT provides a mechanism to handle nodes that are not explicitly addressed, using the built-in template rule. The processor implements built-in template rules automatically.

There are built-in template rules for all node types; however, not all built-in templates generate output. The built-in template for the root node and element nodes simply processes the children of each node, using <xsl:apply-templates> as shown in Example 3-18.

Example 3-18. Built-in template rule for root and element nodes.
<xsl:template match="*|/">
  <xsl:apply-templates/>
</xsl:template>

The built-in template for text and attribute ...

Get XSLT and XPATH: A Guide to XML Transformations 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.