Project

Profile

Help

Bug #2219

closed

xsl:next-match; patterns using match="$var" syntax

Added by Michael Kay about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
Start date:
2014-11-12
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

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:copy

<xsl:apply-templates select="@* , node()"/>

</xsl:copy>

</xsl:template>

<xsl:template match="$start-node" priority="5">

new:start/

xsl:next-match/

</xsl:template>

<xsl:template match="$end-node">

<xsl:value-of select="."/>

new:end/

</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

Also available in: Atom PDF