On 13/01/2014 12:53, Michael Kay wrote:
No. Counter-example: count(following-sibling::x) is not streamable.
More specifically, count(X) is streamable (more specifically, its posture is
grounded) if the posture of X is grounded, climbing, striding, or crawling, but
not if it is roaming.
Sorry - I know that's a lot of new jargon to absorb on a Monday morning!
To clarify (or muddy) the situation a little more ..... whilst:
count(//h)
on its own would be streamable (it has grounded posture, and returns
NO nodes from the context subtree),
count(//h) + count(//j)
is not streamable, since though each separately is grounded, BOTH
have consuming sweep, i.e. they each consume the entirety of the
context subtree and the posture becomes roaming - there has to be
some form of buffering to be able to satisfy the second operand's
sweep over its data.
If both were members of a choice group (i.e. only one of them can
actually operate in any execution) then streamability may be
restored - such a case would be if($h) then count(//h) else
count(//j).
Of course clever understanding of the deeper semantics could cause a
rewrite, such as count(//*[self::h|self::j]) to have grounded posture
and be streamable on its own, but that requires knowledge of a
distribution rule for count() and + and rewrites for (//h|//j).
Actually that's a pretty simple case, so perhaps we need machines to at
least help check.... I hope to have something we can show at XMLPrague.
John
--
*John Lumley* MA PhD CEng FIEE
john(_at_)saxonica(_dot_)com <mailto:john(_at_)saxonica(_dot_)com>
on behalf of Saxonica Ltd
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--