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 24764 - [xslt 3.0] xsl:context-item and the initial input sequence
Summary: [xslt 3.0] xsl:context-item and the initial input sequence
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: 2014-02-21 15:21 UTC by Michael Kay
Modified: 2014-07-03 16:45 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2014-02-21 15:21:39 UTC
In the latest spec we distinguish between "priming" a stylesheet, at which point we supply an initial context item, and invoking an initial mode, at which point we supply an "initial input sequence".

The documentation for xsl:mode/xsl:context-item continues to talk about it constraining the "initial context item for the mode", which doesn't match the new terminology, nor the fact that it can now be a sequence rather than an item.

In addition, we now have no way to declare anything about the initial context item used for initializing global variables.

Suggestion:

(a) we allow xsl:context-item as a child of xsl:package, to declare the expected type of the context item used by the global variables in that package. (There is only one initial context item for the transformation, and it must match the requirements of all packages).

(b) in xsl:mode, we remove the xsl:context-item child. We could replace it with some new element/attribute that gives the required type of the initial input sequence, but this isn't really needed because it can be constrained using the match attributes of the templates in the mode, together with an "on-no-match='fail'" attribute at the mode level.
Comment 1 Michael Kay 2014-02-28 17:13:45 UTC
I would also suggest a change in terminology:

(a) call the context item for evaluating global variables the "global context item" (rather than initial context item), to establish a clearer link with global variables and reduce the linkage with the initial template.

(b) call the "initial input sequence" the "initial match selection" to link it more closely to the "apply-templates" style of processing. (Using "selection" rather than "sequence" works better since most of the time it will be a single item.)
Comment 2 Michael Kay 2014-04-24 21:10:59 UTC
The WG considered this today and asked the editor to produce a detailed proposal.

Proposal (still an outline, but the next stage is drafting within the XML master):

1. Change the term "initial context item" to "global context item".

Note: some refereces to the ICI, eg that in the second bullet of 2.3.3 and that in the first bullet of 2.10, and in the last sentence of 3.9, are incorrect, and should refer to items in the initial match selection.

2. Change the term "initial input sequence" to "initial match selection".

3. Add to the (two different) definitions of "source tree" in 2.1 and 4.4, "trees containing nodes that are present in the initial match selection".

4. Drop xsl:context-item as a child of xsl:mode. This mainly affects 6.6.1 and 6.7 (in a substantial but fairly obvious way), and other isolated references to xsl:context-item throughout the document.

5. Introduce a new top-level declaration xsl:global-context-item with the same content model as the current xsl:context-item, and semantics closely modelled on the xsl:context-item that currently appears as a child of xsl:mode; but constraining the global context item, not the initial match selection. If there are multiple declarations within a package the highest precedence one wins. If there are declarations in several packages then the global context item must satisfy all of them.

6. Rework the two examples (in 2.9 and 6.7.1) showing how to constrain the global conetxt item and/or the initial match selection.
Comment 3 Michael Kay 2014-05-15 16:34:55 UTC
Note, the changes have been applied to the spec but the bug is still open awaiting WG review
Comment 4 Michael Kay 2014-07-03 16:45:06 UTC
The relveant parts of the spec were reviewed last week so this is now resolved.