This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: a nicer total sibling count than this
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- To: scruss at sympatico dot ca
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 18 Sep 2002 21:49:07 -0700 (PDT)
- Subject: [xsl] Re: Re: a nicer total sibling count than this
- Reply-to: xsl-list at lists dot mulberrytech dot com
--- 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