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 29122 - [XSLT30] declared-modes and [xsl:]default-mode
Summary: [XSLT30] declared-modes and [xsl:]default-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 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: 2015-09-12 17:47 UTC by Michael Kay
Modified: 2015-10-29 12:42 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2015-09-12 17:47:28 UTC
We say in relation to declared-modes:

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 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 these contexts, unless the package either contains an explicit xsl:mode declaration for that mode, or accepts the mode from a used package. If the value is no, then this is not an error.

In message https://lists.w3.org/Archives/Member/w3c-xsl-wg/2015Sep/0015.html (member-only) it is pointed out that this could be read as indicating that since the default for [xsl:]default-mode is #unnamed, a stylesheet that does not use the [xsl:]default-mode attribute must declare the unnamed mode.

Furthermore the error condition for XTSE3085, unlike the prose description, does not make it an error to reference an undeclared mode in @default-mode unless the default value is actually used.

I think these ambiguities can be avoided by

(a) shortening the prose description to:

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 unless the package either contains an explicit xsl:mode declaration for that mode, or accepts the mode from a used package. If the value is no, then this is not an error.

(b) tightening the error description to:

[ERR XTSE3085] It is a static error, when the effective value of the declared-modes attribute of an xsl:package element is yes, if the package contains an explicit reference to an undeclared mode, or if it implicitly uses the unnamed mode and the unnamed mode is undeclared. A mode is declared if the package contains an xsl:mode declaration for that mode, or if the mode is a public or final mode accepted from a used package. The offending reference may occur in the mode attribute of an xsl:template or xsl:apply-templates instruction, or in an [xsl:]default-mode attribute. The offending reference may be either an explicit mode name, or the token #unnamed treated as a reference to the unnamed mode. A package implicitly uses the unnamed mode if there is an xsl:template or xsl:apply-templates element with no mode attribute, and with no ancestor having an [xsl:]default-mode attribute.
Comment 1 Michael Kay 2015-09-12 19:25:34 UTC
I have applied these changes to the spec, while leaving the bug open for WG review.
Comment 2 Michael Kay 2015-10-01 17:11:36 UTC
The change was accepted. But in the diff version of the document there is a problem with one of the links to the changes.
Comment 3 Michael Kay 2015-10-01 17:52:46 UTC
Re the markup problem: I think the anchor was on a p element child of an error element which the stylesheet doesn't copy into the HTML. Fixed this, but won't know it's really fixed until the spec is rebuilt. Closing now.