Name

<xsl:apply-templates>

Synopsis

<xsl:apply-templates [select= pattern ”]/>

Description

Specifies that the immediate children 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. You can optionally use the select attribute to determine which children 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.

Get XML Pocket Reference 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.