[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: count hits/matches - INCREMENT

Subject: Re: count hits/matches - INCREMENT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 20 Jun 2005 14:20:38 +0100
xsl count increment
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.