Chooses the next template to execute.

Category: instruction
Content: ( xsl:with-param | xsl:fallback )*
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
Element has no attributes

Saxon availability

Available in XSLT 2.0 and later versions. Available in all Saxon editions. Available for all platforms.


The xsl:next-match instruction was introduced in XSLT 2.0. It is very similar to xsl:apply-imports, but with a different algorithm for choosing the next template to execute. It chooses the template rule that matches the current node and that would have been chosen if the current template rule and all higher precedence/priority rules were not there.

In practice xsl:next-match is nearly always preferable to xsl:apply-imports since the rules for using it are much more flexible and more intuitive.

Links to W3C specifications

XSLT 2.0 Specification

XSLT 3.0 Specification

See also