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 26330 - [XSLT30] The semantics for the applies-to attribute on accumulators prevents use with non-document initial context items
Summary: [XSLT30] The semantics for the applies-to attribute on accumulators prevents ...
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:
: 26471 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-14 13:18 UTC by Abel Braaksma
Modified: 2014-08-02 14:02 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2014-07-14 13:18:50 UTC
The initial context item for a stylesheet transformation can be set to something other than a document node. However, the current definition of accumulators is such that it only applies to nodes that are rooted in a document node:

Section 18.2.1:
"An accumulator is applicable to a particular document if the pattern supplied in the applies-to attribute matches the first element node in the document (typically the outermost element, though the definition allows for document nodes that have more than one element child). The default value for the applies-to attribute is applies-to="*", which ensures that the accumulator is applicable to every document."

I think this definition has two issues:
1) instead of speaking of document nodes, it should (probably) speak of initial context items.
2) the current default pattern is "*", but this does not trigger the accumulator for patterns that are not an element and that, potentially, precede the first element in a document. Perhaps a default pattern of "node()" makes more sense.

This bug-entry is somewhat related to Bug 26328.
Comment 1 Michael Kay 2014-07-31 15:18:13 UTC
We resolved as follows:

(a) the @applies-to attribute should be a pattern, which must be motionless if the accumulator is streamable

(b) accumulator rules are only tested/applied for nodes within a subtree rooted at a node that matches the applies-to pattern. This node can be of any node kind.

(c) accumulator-before and accumulator-after are available on any node, whether or not the tree contains a node that matches applies-to. (If no node anywhere in the tree matches the applies-to pattern, the value will always be the initial value.)

(d) the new-value in an accumulator rule can be computed using a sequence constructor as an alternative to an xpath expression

(e) the new-value attribute is renamed "select"
Comment 2 Michael Kay 2014-07-31 16:16:55 UTC
*** Bug 26471 has been marked as a duplicate of this bug. ***
Comment 3 Michael Kay 2014-08-02 14:02:32 UTC
The changes have been applied.