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

RE: XSL: For-Each Efficient or Not?

Subject: RE: XSL: For-Each Efficient or Not?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 1 Jul 2002 18:59:54 +0100
RE:  XSL: For-Each Efficient or Not?
> Wendell wrote:
> >m:apply[factorof[not(preceding-sibling::*)]]
> 
> >will be better than
> 
> >m:apply[child::*[position()=1 and name()='factorof']]
> 
> at first I didn't get your point on this one. I supposed on 
> further consideration that it was right, although it seems 
> like it would be mainly dependent on the order in which xpath 
> is evaluated by the processor, I mean that a reasonably 
> clever processor would evaluate [position()=1 and 
> name()='factorof'] first and then from there look for any 
> child::* which matched this, with the result that it would 
> only check the first child to see if it had a name of 
> factorof? Am I very wrong in this supposition?

In general, positional tests in a match pattern are very expensive, for
example if you write match="item[last()-1]" then the system will have to
test the item to find out how many preceding items there are, how many
items there are in total, and hence whether this is the last but 1.

Saxon tries to optimize the common cases item[1] and item[last()],
turning them into tests on the existence of a preceding/following
sibling. Other processors may or may not do the same.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.