Skip to content
xsl:next-match

xsl:next-match

Inside a matching template, finds the next applicable template rule (one with lower import precedence or priority) and runs it on the same context node.

<xsl:template match="para">
  <div class="custom">
    <xsl:next-match/>
  </div>
</xsl:template>

This is the XSLT equivalent of super calls in object-oriented languages. It lets one template wrap or augment the result of another template that would otherwise have matched the same node, without having to know which one. xsl:with-param children pass parameters to the next template.

Attributes

None (apart from optional xsl:with-param children).

Example

Layered formatting where one rule adds a wrapper around the rule from an imported stylesheet:

<!-- in main.xsl, importing base.xsl which has its own match="title" -->
<xsl:template match="title">
  <header class="boxed">
    <xsl:next-match/>
  </header>
</xsl:template>