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 3690 - The set of all possible modes is not clearly defined
Summary: The set of all possible modes is not clearly defined
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Linux
: 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: 2006-09-10 07:23 UTC by Colin Adams
Modified: 2006-09-14 23:19 UTC (History)
0 users

See Also:


Attachments

Description Colin Adams 2006-09-10 07:23:16 UTC
Section 2.3 says that an optional initial mode must be supplied, but it does not specify what is the possible sets of values that this take.

This is relevant when the initial template candidates include one with a mode of #all.

Does #all match all theoretically valid modes (i.e. the local name is a valid NCName, and the namespace URI, if present, is a lexically valid URI), or does it match only those nodes that are present in the (compiled) stylesheet?

I had assumed the latter, but a test case assumes the former.

I have read over the spec again, to see if my assumption can be dis-proven, but I cannot see that. Nor can I see it the other way, so I think the spec. is ambiguous.
Comment 1 Colin Adams 2006-09-10 08:00:33 UTC
When I raised the bug, I was only concerned that the ambiuity was resolved one way or the other.
But now having thought about it a bit more, it is clear to me that it should be resolved in the direction of only allowing modes that are specifically defined in the compiled stylesheet.

The only reason for supplying an initial mode is to override the default mode. So it makes no sense to supply a mode that is not defined. And it is very harmful, if the selected initial template (or some descendant of it in the match/call chain) should then dispatch on the current mode.

The user is entitled to a good error message if (s)he mis-types the name of the initial mode.

I can think of no use cases for the opposite interpretation.
Comment 2 Michael Kay 2006-09-13 19:36:23 UTC
I agree. I would propose:

(a) In 6.5 change

the token #all, to indicate that the template rule is applicable to all modes.

to

the token #all, to indicate that the template rule is applicable to all modes (that is, to the default mode and to every mode that is named in an xsl:apply-templates instruction or xsl:template declaration anywhere in the stylesheet)

(b) In 2.3 change

Optionally, an initial mode.

to

Optionally, an initial mode. This must be either the default mode, or a mode that is explicitly named in the mode attribute of an xsl:template declaration within the stylesheet.

(c) Add to this paragraph: If an initial mode is supplied, then an initial context node MUST be supplied, and an initial template MUST NOT be supplied.

(d) Add error codes for the above conditions.
Comment 3 Colin Adams 2006-09-14 07:17:35 UTC
Sounds good to me.
Comment 4 Michael Kay 2006-09-14 17:58:51 UTC
The proposal in comment #2 was accepted at today's telcon.
Comment 5 Michael Kay 2006-09-14 23:19:21 UTC
Spec now updated