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 4843 - [XSLT 2.0] Current mode is underspecified
Summary: [XSLT 2.0] Current mode is underspecified
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: 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: 2007-07-10 10:19 UTC by Michael Kay
Modified: 2008-10-08 16:56 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2007-07-10 10:19:07 UTC
It's not clear in the specification what the current mode is under all conditions: for example, when evaluating a global variable, an attribute set, or the sequence constructor contained in xsl:key or xsl:sort. This affects the outcome of <xsl:apply-templates mode="#current"/> in these contexts. (It does not affect xsl:apply-imports or xsl:next-match, because in all these contexts the current template rule is null, so the instruction will fail.)

Possible answers are: the initial mode, the default mode, "null", or (for attribute sets and xsl:sort only) the mode of the caller.

Also, section 5.4.4 says the current mode is "cleared" when calling a stylesheet function, without saying what this means; section 6.5 explains that it means the current mode is set to the default mode, which isn't necessarily what you might expect.

Proposal: the current mode should be "cleared" when evaluating a global variable, the default value of a stylesheet parameter, or the sequence constructor contained in xsl:key or xsl:sort; and we should clarify that "cleared" means that it reverts to the default (unnamed) mode. For attribute sets we should clarify that the current mode is unchanged (same as caller). This is to align with the rules for the current template rule.
Comment 1 Michael Kay 2007-07-19 16:51:15 UTC
On July 19 the WG looked at this and agreed with the broad direction proposed, subject to seeing detailed wording.
Comment 2 Michael Kay 2007-10-11 06:36:45 UTC
Proposal:

In the table in 5.4.4, row "current mode", column "cleared by", change the content of the cell to "calls to stylesheet functions, evaluation of global variables and stylesheet parameters, evaluation of the sequence constructor contained in xsl:key or xsl:sort. Clearing the current mode causes the current mode to be set to the default (unnamed) mode.

In 6.5, change "the current mode becomes the default mode" to "the current mode is set to the default mode" (the current phrase is ambiguous, it is not clear whether it means default:=current or current:=default). 

In 6.5 before "No other instruction changes the current mode. " add "While evaluating global variables and parameters, and the sequence constructor contained in xsl:key or xsl:sort, the current mode is set to the default mode."

After "No other instruction changes the current mode. " add the sentence "The current mode while evaluating an attribute set is the same as the current mode of the caller."
Comment 3 Michael Kay 2007-11-15 17:39:22 UTC
The proposal in comment #2 was accepted at the telcon on 15 Nov 2007, the editor was asked to prepare an Erratum.
Comment 4 Michael Kay 2008-03-20 11:14:29 UTC
Erratum E19 has been drafted.