Re: [xsl] count hits/matches - INCREMENT

Subject: Re: [xsl] count hits/matches - INCREMENT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 20 Jun 2005 14:20:38 +0100
> Is it possible in XSL to change the value of a variable in a
> <xls:for-each> and get the value after the <xsl:for-each>? 

No, there is no need to do such strange contortions as required in
imperative languages. If you need to know how many nodes are in a node
set use select="count()" or if it is the current node set (for example
you are inside the for-each, you can use last()

so if you have

<xsl:for-each select="/a/b/c"> ...

Then 
<xsl:value-of select="count(/a/b/c)"/>
and 
<xsl:value-of select="last()"/> 
both return the number of nodes in this set (last() is likely to be more
efficient here, but of course count() is more general as you can count
any node set)

David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread