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 24545 - Syntax for xsl:mode misses initial attribute
Summary: Syntax for xsl:mode misses initial attribute
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
: 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: 2014-02-05 23:40 UTC by Abel Braaksma
Modified: 2014-05-15 14:00 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2014-02-05 23:40:11 UTC
Under 6.6.1 Declaring Modes (http://www.w3.org/TR/xslt-30/#declaring-modes), the xsl:mode declaration misses the initial attribute. Same under section D Element Syntax Summary (Non-Normative).

Also, in the table in that section that describes the defaults, the initial attribute is also missing.

It is, however, mentioned in the text body of that section.
Comment 1 Michael Kay 2014-02-06 18:09:49 UTC
I have added the "initial" attribute to the element syntax catalog and to the table (with default value "yes"). It was already present in the schema for XSLT.

There seem to be two error conditions missing:

(a) initial="yes" with visibility="private". (Perhaps initial should default to "no" if visibility="private")

(b) invoking a transformation with an initial mode that is declared with initial="no".
Comment 2 C. M. Sperberg-McQueen 2014-02-12 11:45:21 UTC
The WG discussed this during the ftf meeting in Prague and noted that the initial comment appears to have been resolved; the problems noted in comment 1 remain to be fixed.

We spent some time worrying at the problem that the default initial mode is the unnamed mode (for backward compatibility), and the unnamed mode is necessarily private in packages.  Among the ideas floated:

a) allow invocation with initial-mode = #default-initial-mode (invoking it by role and not by name); this doesn't seem to answer questions about the desired relation between the visibility and initial attributes (are both needed?).  

a') allow invocation with initial-mode = "".

b) make the unnamed mode in the top-level package be visible to the calling application; this means the unnamed mode is treated differently from other private components.

c) make the private components in the top-level package visible to the calling application; this means the calling application has access to names not accessible to other packages using this one as a library package.

d) make the unnamed mode visible in stylesheet modules which lack xsl:package, but invisible in packages; this means that wrapping a stylesheet in xsl:package can mean it no longer works in contexts where it used to work.

e) remove the visibility attribute from the unnamed mode.

f) remove the 'initial' attribute; all public modes are eligible to be the initial mode; special-case the unnamed mode, which is always eligible to be the initial mode despite being private. 

We took a straw poll; the strong preponderance of sentiment was in favor of f).  We'll need to see this again because there will be interactions with our resolutions of other bugs.
Comment 3 Michael Kay 2014-02-17 17:20:50 UTC
The implications of removing the "initial" attribute of xsl:mode appear to be as follows:

A. Remove the attribute from the element syntax summary and the schema for XSLT.

B. Remove it from various examples: 2.9, 6.7.1.

C. In 6.6.1, in the definition of "mode definition", change "in a stylesheet" to "in a package".

D. In the following paragraph, change:

If a stylesheet does not contain a declaration of the unnamed mode, a declaration is implied equivalent to an xsl:mode element with the single attribute initial="yes". Similarly, if there is a mode that is named in an xsl:template or xsl:apply-templates element, or in the [xsl:]default-mode attribute of a containing element, and the stylesheet does not contain a declaration of that mode, then a declaration is implied comprising an xsl:mode element with a name attribute plus the attribute initial="yes".

to

If a package does not contain a declaration of the unnamed mode, a declaration is implied equivalent to an xsl:mode element with no attributes. Similarly, if there is a mode that is named in an xsl:template or xsl:apply-templates element, or in the [xsl:]default-mode attribute of a containing element, and the stylesheet does not contain a declaration of that mode, then a declaration is implied comprising an xsl:mode element with a name attribute equal to that mode name, plus the attribute visibility="public".

E. In the description of error XTSE0542, rather than applying to nodes with initial="no", this now applies to any named mode specifying visibility="private".

F. Ensure there is no entry for "initial" in the table in 6.6.1 (there is none in the Public WD, but such a row has been added in an attempt to fix o separate problem.

G. In the same table, entry for visibility, change "A mode is not eligible to be used as the initial mode if its visibility is private." to "A named mode is not eligible to be used as the initial mode if its visibility is private.".

H. Change the static error 

[ERR XTSE0548] It is a static error if there is both (a) a mode definition in the stylesheet that has the effective attribute values streamable="yes" and initial="yes", and (b) a global variable in the stylesheet whose initializing expression is not motionless with respect to its context item, as defined in 19 Streamability.

to a dynamic error:

[ERR XTDE0548] It is a dynamic error if the stylesheeet is evaluated with an initial mode that has the effective attribute values streamable="yes", if there is a global variable in the stylesheet whose initializing expression is not motionless with respect to its context item, as defined in 19 Streamability.
Comment 4 Michael Kay 2014-03-19 10:22:19 UTC
The proposal was accepted on 6 March 2014: see minutes.