[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] General rule for designing XPath expressions to return items in document order?


Subject: Re: [xsl] General rule for designing XPath expressions to return items in document order?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 10 Jan 2014 11:01:23 +0000

On 10 January 2014 10:56, Costello, Roger L. <costello@xxxxxxxxx> wrote:
> David wrote:
>
>         I haven't checked the streaming rules in detail
>         but I would expect //head to be streamable.
>         (You might not be able to access any of the
>         child nodes in a streamable way but for example
>         count(//head) ought to be able to count all the
>         head in the document in a single pass.
>
> Michael responded:
>
>         That's a fair summary. //head is "consuming"
>         (it reads the input stream), and "crawling"
>         (it accesses all the nodes in the subtree). When
>         you get an expression that is consuming and
>         crawling, you are allowed to do "inspection"
>         operations on the result, for example count()
>
> But Michael doesn't that contradict section 19.1 of the XSLT 3.0 specification:
>
>         For example <xsl:value-of select="//head"/> will
>         still fail the streamability tests, because of the
>         possibility that one head element is a child of
>         another. This problem can be remedied by
>         writing <xsl:value-of select="//head/text()"/>.

He did also say:

"but you are
not allowed to do "absorption" operations such as string() or data() or
copy-of()."

and you quote from the spec is effectively that.


-- 
Andrew Welch
http://andrewjwelch.com


Current Thread
Keywords