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 28453 - [XSLT30] (editorial) [xsl:]default-mode, declared-modes and the initial mode
Summary: [XSLT30] (editorial) [xsl:]default-mode, declared-modes and the initial mode
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: P4 trivial
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: 2015-04-09 13:15 UTC by Abel Braaksma
Modified: 2015-06-05 16:46 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2015-04-09 13:15:08 UTC
We say, about the initial mode:

> [Definition: The initial mode, if specified, must either be the unnamed mode, 
> or a mode that is explicitly named either in an xsl:mode declaration, or in 
> the mode attribute of an xsl:template declaration within the stylesheet. If 
> an initial mode is supplied, then in searching for the template rule that 
> best matches the items in the initial match selection, the processor 
> considers only those rules that apply to the initial mode. If no initial mode 
> is supplied, then the mode used is that named in the default-mode attribute 
> of the (explicit or implicit) xsl:package element of the top-level package or 
> in the absence of such an attribute, the unnamed mode.]

However, this means that if you have a default-mode attribute that does not exist explicitly, and you specify that mode explicitly as initial mode, that it would be an error. I don't think that is desirable. I propose to add after "or in the mode attribute of an xsl:template declaration" something like ", or in an [xsl:]default-mode attribute".

And we say, about the default-mode:

> The value must either be an EQName, or the token #unnamed which refers to 
> the unnamed mode. It is not necessary for the referenced mode to be 
> explicitly declared in an xsl:mode declaration.

But this is no longer true for packages with an implicit or explicit declared-modes="yes" in packages. I propose to add something like ", unless declared-modes='yes'.".
Comment 1 Michael Kay 2015-04-30 08:36:18 UTC
I agree. Proposal:

(A). Change the definition of initial mode to say:

[Definition: The initial mode, if specified, must either be the unnamed mode, 
> or a mode that is explicitly named either in an xsl:mode declaration, or in 
> the mode attribute of an xsl:template declaration within the stylesheet, or in the *default-mode* attribute of an xsl:stylesheet or xsl:package element.

(B) I propose adding to 3.5.4.1:

The declared-modes attribute of xsl:package determines whether or not modes that are referenced within the package must be explicitly declared. If the value is yes (the default), then it is an error to use a mode name in the mode attribute of xsl:template or xsl:apply-templates, or in the [xsl]:default-mode attribute of any element, or to use the unnamed mode explicitly or implicitly in those contexts, unless the package contains an explicit xsl:mode declaration for that mode.

(C) I propose changing the sentence "It is not necessary for the referenced mode to be 
> explicitly declared in an xsl:mode declaration." to a note, adding the qualifier "unless the attribute declared-modes="yes" is present".
Comment 2 Michael Kay 2015-05-01 07:37:15 UTC
The changes were agreed and have been applied. For avoidance of doubt, I changed the Note in (c) to say

It is not necessary for the referenced mode to be explicitly declared in an 
                     <elcode>xsl:mode</elcode> declaration, unless this is mandated by the <code>declared-modes</code>
                     attribute (which defaults to <code>yes</code> on an <elcode>xsl:package</elcode> element).
Comment 3 Abel Braaksma 2015-06-05 16:46:38 UTC
As discussed by the latest telcon, I was tasked to review these changes. I have now done so and see no ambiguities in the proposed texts.

Closing this bug as CLOSED - FIXED.