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 29803 - [XSLT30] We accidentally lost the ability to use accumulators on streamed nodes in the initial match selection, and other remnants of removing @streamable from xsl:global-context-item
Summary: [XSLT30] We accidentally lost the ability to use accumulators on streamed nod...
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
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: 2016-09-02 15:44 UTC by Abel Braaksma
Modified: 2016-09-09 21:41 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2016-09-02 15:44:45 UTC
This bug applies to section 18.2.2, Applicability of Accumulators.

After we dropped @streamable from xsl:global-context-item (GCI) as a resolution to bug 29696, we lost the ability to declaratively specify what accumulators apply to a given input tree from a the initial match selection (IMS).

In the previous situation, if the GCI == IMS, the @use-accumulators applied to both. We dropped this, so we lost the ability to specify what accumulators should or should not be calculated on streamed IMS's.

There are some ways we can fix this:

1) Add @use-accumulators as an attribute to xsl:stylesheet/transform/package, only to apply to the containing package (similar to the scope of its accumulators).

Advantages: simple to add, not so disruptive

Disadvantages: it requires access to its child elements (i.e., it is a forward declaration), which we do not allow otherwise

2) Add a declaration xsl:initial-match-selection with @streamable and @use-accumulators. The semantics would be that *if* the IMS contains one or more streamed nodes, these accumulators are applicable. It is ignored for non-streamed nodes, or if @streamable="no" (similar to xsl:merge-source).

Advantages: clear to the end user what its meaning is, fixes the use-case and makes it programmable with shadow attributes.

Disadvantages: it is a new declaration and we rather not add new stuff in CR

3) Leave the status-quo as is, but specify the default: either #all, or #none.

Advantages: no new syntax needed

Disadvantages: leaves the implementation-defined behavior in place if a user wants to specify something different.

4) Do nothing

Advantages: nothing to change

Disadvantages: makes using streamable accumulators highly implementation-dependent with potentially big interoperability issues

5) Require that implementations provide a @use-accumulators type of functionality, which we can by describing this under 2.3.2. Priming a stylesheet.

Advantages: it makes this feature testable and, while API dependent, a reliable part of any implementation that supports the streaming feature, which improves interoperability.

Disadvantages: user can only set this by the API


-------------------------------------

Some other observations (editorial):

Under 18.2.2 the following paragraph should be dropped:

"When a streamed node is supplied as the global context item, the set of accumulators applicable to the document containing the global context item can be declared using the use-accumulators attribute of the xsl:global-context-item declaration. (Note that this is only useful when the global context item is also present in the initial match selection, since references to a streamable global context item per se are always motionless.)"

Also under 18.2.2, remove xsl:global-context-item:

"The accumulator is declared as being applicable to the tree in question, using the use-accumulators attribute on xsl:source-document, xsl:merge-source, or xsl:global-context-item; or"
Comment 1 Michael Kay 2016-09-07 23:07:16 UTC
I agree there's a gap here.

I'm inclined to say we should add a @use-accumulators attribute to xsl:mode, applicable only when streamable="yes". The semantics are: when the mode is used as the initial mode for apply-templates invocation of the stylesheet, then for any streamed (document?) node that is present in the initial match selection, the specified accumulators will be maintained for that document.
Comment 2 Abel Braaksma 2016-09-08 08:43:13 UTC
Re comment#1: I think I didn't list xsl:mode as candidate as I was worried about overriding. Accumulators are local to a package, and overriding them seems to me to allow them to be accessible at least within overriding templates.
Comment 3 Michael Kay 2016-09-09 21:41:53 UTC
We agreed to adopt comment #1: put the use-accumulators attribute on the xsl:mode declaration for the initial mode. The changes have been applied.