This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: a nicer total sibling count than this


--- scruss at sympatico dot ca  wrote:

 
> Jeni Tennison wrote:
> > 
> >   <xsl:if test="../def[2]">
> >     ...
> >   </xsl:if>
> 
> How elegant! Thank you.
> 
> Think I'll be off to Chapters.ca now to buy your book
> (and DaveP's too, since I'll have to print this thing eventually.)
> 
>  Stewart

While this is indeed ellegant, the reason Jeni put first the other
solution:

preceding-sibling::def or following-sibling::def

I think, is because three nodes must be visited in order to evaluate
../def[2], while the "or" expression above can be evaluated visiting
two nodes (worse case) or even only a single node (best case).

This means that the "or" expression above can be evaluated from 1.5 to
three times faster.

Of course, the absolute time difference will be very small, but if such
expressions are evaluated many times there could be some greater time
savings.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]