Name
[2.0] <xsl:next-match>
Tells the XSLT processor to select a template that is
the next lowest in priority than the current template. This works
similarly to <xsl:apply-imports>, although <xsl:next-match> works with all
templates, including those in the main stylesheet and in any
stylesheets included or imported. Using <xsl:next-match> allows you to set up
templates that work like overridden methods in object-oriented
languages; using <xsl:next-match> is conceptually the
same as calling super() in a
Java program.
Category
Instruction.
Required Attributes
None.
Optional Attributes
None.
Content
Any number of <xsl:with-param> and <xsl:fallback> elements.
Appears in
<xsl:next-match>
appears inside a template.
Defined in
[2.0] XSLT section 6.7, “Overriding Template Rules.”
Example
For our example, we’ll create some templates to process this HTML document:
<!-- element-discussion.html -->
<html>
<head>
<title>Interesting new XSLT elements</title>
</head>
<body>
<h1>Interesting new XSLT elements</h1>
<p>XSLT 2.0 has lots of interesting new elements.
We'll mention a couple of them here. </p>
<h1>The <code><xsl:next-match></code> element</h1>
<p>One of the most interesting new elements in XSLT 2.0
is <code><xsl:next-match></code>. </p>
<h1>The <code><xsl:perform-sort></code> element</h1>
<p>Don't forget about <code><xsl:perform-sort></code>,
though. It's very interesting as well.</p>
</body>
</html>Our example document has HTML <code>
elements. Some of them are inside <h1> elements, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access