[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Best way to count siblings


Subject: RE: [xsl] Best way to count siblings
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 15 Dec 2004 08:52:39 -0000

Forming the union of two sets that you know to be disjoint is likely to
involve unnecessary sorting and de-duplication operations. Better to use

count(preceding-sibling::*) + count(following-sibling::*)

or why not count(../*)-1 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Karl Stubsjoen [mailto:karl@xxxxxxxxxxxxxxxxxxxx] 
> Sent: 15 December 2004 17:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Best way to count siblings
> 
> Is this the best way to count siblings?
> 
> <xsl:value-of select="count(preceding-sibling::* | 
> following-sibling::*)"/>


Current Thread