Streaming: effect of "/" versus "!"
Test case sx-intersect-313
This may be a problem in the spec rather than in the Saxon implementation.
(A intersect B) / (.+1) is streamable, while
(A intersect B) ! (.+1) is not. This seems unreasonable, since they are obviously equivalent.
Updated by Michael Kay about 1 month ago
An observation: the spec says that given the expression (A § B) where § is
except, then if A and B are both striding, the result is crawling.
This is legitimate in the case of union, because for example
(A/B union */*/C) can contain two nodes where one is an ancestor of the other. But it is unnecessarily restrictive for
except, because with these operators, every node in the result is present in the value of the LH operand, and therefore if the LH operand is striding (contains no nested nodes) then the result is striding as well.
For union, we can make the result striding if the two operands have the same "constant depth" (the number of child selections). But the spec doesn't have the machinery to calculate the "constant depth" of an expression. In Saxon we possibly do, in the form of the path maps used for analysis of XQuery projection.
Please register to edit this issue