A couple days ago Michael Kay wrote:
count(//x) is streamable, but data(//x) is not.
Here //x is a "crawling" expression - one that
selects nodes which may overlap each other.
When an expression returns (potentially)
overlapping nodes, the W3C spec says you
can apply inspection operations like count()
to those nodes, but you cannot apply absorption
expressions like data(), because doing so would
require buffering.
I'm getting hung up on terminology: crawling, inspection, absorption, overlap.
Even though (I think) that I now understand those terms, I still don't
understand why one expression is streamable while another is not. For example,
why is count(//x) streamable whereas data(//x) is not? I don't want to
remember a bunch of definitions and rules (which I will quickly forget). I want
to understand the concepts (which I won't forget).
I understand best with examples. Consider this XML:
<Document>
<x>
<x>A</x>
B
</x>
</Document>
This XPath expression:
//x
returns a sequence of two subtrees:
<x>
<x>A</x>
B
</x>
<x>A</x>
Michael, would you take us (conceptually) through the process an XSLT
processor would go through - as it incrementally steps through the XML document
- to count the number of <x> elements?
And would you explain why the data(//x) operation would require buffering and
is therefore not streamable, please?
/Roger
--~------------------------------------------------------------------
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>
--~--