Given an XML like this:
<a id="1">
<b>
<code>42</code>
</b>
</a>
And the target being:
<request>
<aId>1</aId>
<bCode>42</bCode>
</request>
I can reach that using this XSLT:
<template match="/">
<element name="request">
<apply-templates/>
</element>
</template>
<template match="a">
<element name="aId"><value-of select="@id"/></element>
<apply-templates/>
</template>
<template match="b/code">
<element name="bCode"><value-of select="."/></element>
</template>
However, this also works if I swap <apply-templates/>
with <next-match/>
. Any advice on which to use when, when they both seem to work fine? Does next-match
have additional effects which can mess things up if I add more stuff later for example?
xsl:next-match
is useful when you need to perform "staged processing" -- and this is clearly not your current case. – Dimitre Novatchev