[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: General rule for designing XPath expressions to r

Subject: Re: General rule for designing XPath expressions to return items in document order?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 9 Jan 2014 11:21:32 +0000
Re:  General rule for designing XPath expressions to  r
> 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.
>>

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(), exists(), or name(), but you
are not allowed to do "absorption" operations such as string() or data() or
copy-of(). Inspection operations on an element are operations that can be
performed while positioned at the start tag, while absorption operations are
operations that require access to the whole subtree.

By contrast, /html/head is consuming and "striding" (the nodes it returns are
peers - none is an ancestor of any other). With a striding expression, you can
perform both inspection and absorption operations. So /html/head/string() is
allowed, but //head/string() is not.

This is horribly technical. Abel Braaksma and I will both be at XML Prague
next month trying to explain it.

Michael Kay
Saxonica

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.