Bug #2219
closedxsl:next-match; patterns using match="$var" syntax
100%
Description
Reported by Martin Honnen on saxon-help list.
Using Saxon 9.6 PE when I run the following stylesheet
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xf="http://www.w3.org/2005/xpath-functions"
xmlns:new="http://example.com/new"
exclude-result-prefixes="xs xf">
<xsl:variable name="start-node" as="text()?"
select="root/p[1]/span[1]/text()"/>
<xsl:variable name="end-node" as="text()?"
select="root/p[2]/span[1]/text()"/>
<xsl:template match="@* | node()">
<xsl:apply-templates select="@* , node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="$start-node" priority="5">
</xsl:template>
<xsl:template match="$end-node">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
against the input
The brown fox jumped over the lazy dog.
El zorro marrón saltó el perro vago.
then I get the result
The brown xmlns:new="http://example.com/new"/>fox<new:end
xmlns:new="http://example.com/new"/> jumped over the lazy dog.
El zorro marrón saltóxmlns:new="http://example.com/new"/> el perro vago.
That looks as if the xsl:next-match for the template <xsl:template
match="$start-node" priority="5"> uses the template <xsl:template
match="$end-node"> which does not seem to make sense to me as the nodes
are different.
When I run the code online with http://www.exselt.net/demo I get the
result I want, namely
The brown xmlns:new="http://example.com/new"/>fox jumped over the lazy dog.
El zorro marrón saltóxmlns:new="http://example.com/new"/> el perro vago.
where the xsl:next-match uses the identity transformation template.
So this looks like a bug in Saxon 9.6 PE or I misunderstand the feature
to match on a variable reference.
Please register to edit this issue