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="*|/"> <xsl:apply-templates/> </xsl:template>
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"/> </xsl:template>
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="."/> </xsl:template>
Finally, this built-in template has the effect of ignoring comments and processing instructions.