This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29716 - [xslt 3.0] xsl:copy and the current template rule
Summary: [xslt 3.0] xsl:copy and the current template rule
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-03 21:47 UTC by Michael Kay
Modified: 2016-10-06 18:42 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2016-07-03 21:47:11 UTC
In 5.3.4 we have a list of instructions that clear the current template rule:

xsl:for-each, xsl:for-each-group, xsl:analyze-string, xsl:iterate, xsl:stream, xsl:merge

The current template rule is used by xsl:apply-imports and xsl:next-match; it doesn't make sense to use these instructions if the context item has changed, so the list above is supposed to include all instructions that execute contained instructions with a new context item.

xsl:copy with a select attribute also sets a new context item, so this should be in the list. But for compatibility with 1.0/2.0, this applies only when there is a select attribute.
Comment 1 Michael Kay 2016-07-03 21:52:43 UTC
In addition, xsl:call-template should probably clear the current template rule if the called template has 

<xsl:context-item use="absent"/>

See also the Note in 6.8

These rules ensure that when xsl:apply-imports or xsl:next-match is called, the context item is the same as when the current template rule was invoked.
Comment 2 Michael Kay 2016-07-10 17:36:47 UTC
Note also that in 5.3.4 the initial setting for the current template rule as currently described is nonsense:

If a named template is supplied as the entry point to the transformation, then absent; otherwise the initial named template

This should read: 

If apply-templates invocation is used (see 2.3.3), then while processing each item in the *initial match selection*, the *current template rule* is initially set to the template rule chosen to process that item. Otherwise, absent.
Comment 3 Michael Kay 2016-07-10 18:10:05 UTC
The changes have been applied to the spec.