This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Section 19.1 talks of the rewrite needed to make count(//section/head) streamable. However, what is described isn't good enough. Firstly, it says the rewrite is only applied to a RelativePathExpr, but the example is not a relative path, it is absolute. Secondly, it rewrites //section/head as //head[parent::section], but this is still not streamable, because //head expands to /descendant-or-self::node()/head which suffers the same problem (use of the child axis in a crawling posture is free-ranging). We actually need to rewrite //para as /descendant-or-self::para()[parent::node()] (which further simplifies to /descendant::para, but I don't think that simplification is needed for stream ability), and we need to rewrite //section/head as /descendant-or-self::head[parent::section]. Perhaps this can be achieved by applying the rewrite recursively, I'm not sure.
I have made some small adjustments to this section which I believe fix the problem, by changing the examples a little and being less prescriptive about the precise form of the rewrite to be carried out.