Open michaelhkay opened 4 years ago
A possible fix is to say that if the declaration of a streaming parameter allows multiple nodes, then a variable reference (to the streaming parameter) that appears within a high-order operand of any construct is roaming and free-ranging.
Consider the function:
This clearly isn't streamable, because it involves jumping around within the sequence $p more than once. But it seems to satisfy the streamability rules in the spec.
Most constructs don't allow more than one operand to be consuming. But xsl:for-each does. The streamability rules for xsl:for-each weren't written with streamable stylesheet functions in mind; it was assumed that if the select expression selected streamed nodes, the body of the xsl:for-each would process them one at a time, with only downward selections allowed.
So there's a rule missing: possibly a rule that the function body must contain at most one reference to the streaming parameter (with a caveat allowing use in multiple choice branches).