This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
"10.4 Dynamic XPath Evaluation" <http://www.w3.org/TR/xslt-30/#dynamic-xpath> says that user-defined functions are part of the static context of the XPath expression to evaluate. But it excludes explicitly accumulators. The reason why it does so is not clear.
I think the rules may be over-restrictive. In the absence of streaming on the accumulator, the only reason to have restrictions is the possibility of circularity (and dependence on order of evaluation) among multiple accumulators. But I don't think this is in principle different from allowing infinite recursion in ordinary function or template calls. So with an accumulator that specifies streamable="no" we should lift restrictions. With streaming on, an alternative design might be to say that if an accumulator function is called and the context node is not the current node in a streamed input document, then calling the accumulator function is allowed, but fails dynamically. This might lead to a simpler set of rules.
We've generally had a rule that streamability must be determinable statically. If we relax the rules disallowing dynamic calls on accumulator functions, we lose this property. However, I think it may be worth doing. Defining the dynamic rules is not entirely trivial, but I think it can be done using the concepts of pre-descent instructions and post-descent instructions in 19.3.3. Something like this: If an accumulator function is called and the context item is a node in a streamed input document, then a dynamic error occurs if neither of the following conditions is true: * the function is a pre-descent function and it is being invoked in the course of evaluating a pre-descent instruction in a template rule that matches the context item * the function is a post-descent function and it is being invoked in the course of evaluating a post-descent instruction in a template rule that matches the context item I think this approach would allow us to be a bit more flexible about evaluating accumulator functions while processing leaf nodes such as text nodes. While we are about it, I'm wondering if we need any special rules to prevent a reference to a streamed node appearing in the closure of a context-dependent function item.
See https://lists.w3.org/Archives/Member/w3c-xsl-wg/2013May/0006.html for proposed resolution
Proposal was accepted (with comments/observations).
The proposed changes have been applied.