cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Nowostawski <>
Subject [xslt] element counting
Date Mon, 12 Jun 2000 03:45:19 GMT
Sorry for being slightly off topic here, but is there any other way to
count (get the number of) particular children of a given element other
than iterating through those children and grabing the last element

At the moment I am doing:

<xsl:for-each select="someTag">
   <xsl:if test="position()=last()">
     do smth with <xsl:value-of select="position()"/>

but it seems to me kind of way around. 
I do not know how to build expression which returns the position of the
last "someTag" element, is it possible?
I have read about <xsl:number>, but I could not make it to work either in
this case, I do not want to "iterate", I just want the total number.

Any suggestions?


View raw message