Next / Previous / Contents / TCC Help System / NM Tech homepage

13. Built-in templates

XSLT supplies several built-in, default templates. These templates make it unnecessary to write templates for every possible situation; you need write templates only for the specific nodes you want to process.

The first built-in template operates on any document node (/) or any element node (*) that doesn't have a more specific template. It uses xsl:apply-templates so that its child elements will be processed.

<xsl:template match="*|/">

If you are using modes, the equivalent of this template also operates for any document or element node. For example, if you use a mode called “toc” somewhere, XSLT will supply a template that works like this:

<xsl:template match="*|/" mode="toc">
  <xsl:apply-templates mode="toc"/>

Another built-in template operates for any text or attribute nodes without more specific templates. It has the effect of copying any text to the output by default.

<xsl:template match="text()|@*">
  <xsl:value-of select="."/>

Finally, this built-in template has the effect of ignoring comments and processing instructions.

<xsl:template match="processing-instruction()|comment()"/>