Name

<xsl:apply-templates>

Synopsis

This specifies that the immediate children (default) or the selected nodes of the source element should be processed further. For example:

<xsl:template match="section">
     <B><xsl:apply-templates/><B>
</xsl:template>

This example processes the children of the selected <section> element after applying a bold tag. The optional select attribute determines which nodes should be processed:

<xsl:template match="section">
   <HR>
   <xsl:apply-templates
      select="paragraph (@indent)//sidebar"/>
   <HR>
   <xsl:apply-templates
      select="paragraph (@indent)/quote"/>
   <HR>
</xsl:template>

This example processes only specific children of the selected <section> element. In this case, the first target is a <sidebar> element that is a descendant of a <paragraph> element that has defined an indent attribute. The second target is a <quote> element that is the direct child of a <paragraph> element that has defined an indent attribute. The optional mode attribute causes only templates with a matching mode to be applied.

<xsl:apply-templates
   [select="node-set-expression"]>
[mode="mode"]/>

Get Webmaster in a Nutshell, Third 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.