Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] XSL: For-Each Efficient or Not?

From: "Michael Kay" <michael.h.kay@------------>
To:
Date: 7/1/2002 9:58:00 AM
> 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent