Streaming: should using a step with /copy-of() make a difference to a map operator with !copy-of()?
Added by Martin Honnen over 3 years ago
Saxon Java EE 10.5 tells me that
<xsl:template match="/">
<xsl:sequence select="count(//team/aussies/cricketer/copy-of()[role = 'Batsman'])"/>
</xsl:template>
is streamable while
<xsl:template match="/">
<xsl:sequence select="count(//team/aussies/cricketer!copy-of()[role = 'Batsman'])"/>
</xsl:template>
is not:
Error on line 12 of count-example2.xsl:
XTSE3430 Template rule is not streamable
* Expression
descendant::cricketer[bytecode(parent::aussies[bytecode(parent::team)])]!xsl:copy-of[bytecode(role = "Batsman")] is not streamable because the select expression is crawling and the body is consuming
* The result of the template rule can contain streamed nodes
Template rule is not streamable
* Expression descendant::cricketer[bytecode(parent::aussies[bytecode(parent::team)])]!xsl:copy-of[bytecode(role = "Batsman")] is not streamable because the select expression is crawling and the body is consuming
* The result of the template rule can contain streamed nodes
With streaming I am always happy if I find a way or path that is streamable but in this case I don't quite understand why doing !copy-of()
makes a difference to /copy-of()
.
Replies (1)
RE: Streaming: should using a step with /copy-of() make a difference to a map operator with !copy-of()? - Added by Michael Kay over 3 years ago
It might be because !copy-of(.)
has to deliver the copies in document order of cricketers, which requires evaluating //team/aussies/cricketer
in document order (which is the famous crawling/consuming //section/head
problem); whereas /copy-of()
effectively allows the copies to be delivered in any order you like, because the last "/" sorts into document order, and the document order of separate trees is implementation-dependent.
Please register to reply