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

Re: following-sibling is evil

Subject: Re: following-sibling is evil
From: "Liam R E Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Jul 2014 17:35:56 -0000
Re:  following-sibling is evil
On Sun, 6 Jul 2014 09:34:28 -0000
"Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>[for each book]

> following-sibling::Book[Title eq $currentAuthor][Genre eq $currentGenre][1]
> 
> As I understand it, an XPath processor will evaluate that XPath expression like so:
> 
> Step 1. Gather up all the following sibling Book elements. Let's denote the resulting set by S1.
> 
> Step 2. Filter S1 by eliminating those Books that don't satisfy this predicate: [Title eq $currentAuthor]. Let's denote the resulting set by S2.
> 
> Step 3. Filter S2 by eliminating those Books that don't satisfy this predicate: [Genre eq $currentGenre]. Let's denote the resulting set by S3.
> 
> Step 4. Filter S3 by eliminating all Books except the first.
> 
> Do I correctly understand how an XPath processor will evaluate the XPath expression?

No - it depends on the engine. An XQuery engine (even running XSLT) is likely to have a database and might start with Genre[. eq $currentGenre]/parent:Book to generate a list of Book elements and then Title[. eq $currentAuthor]/parent::Bool (which probably won't match anything unless you have a lot of biographies by authors represented in the collection), and then do a join on the result. At any rate I've seen such strategies discussed.

However, it is no surprise that the sibling axis should encounter evil, since Jesus said, Get thee behind me Satan.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org
XML Blog: http://people.w3.org/~liam/blog/

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.