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

RE: counting in for each

Subject: RE: counting in for each
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 11 Dec 2005 16:22:48 -0000
RE:  counting in for each
The usual way to handle such requirements is with code such as this:

<xsl:for-each select="item">
  <xsl:choose>
    <xsl:when test="position() mod 2 = 0">...</xsl:when>
    <xsl:otherwise>...</xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

Withing the for-each, the total number of items is available as the result
of the function last().

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

> -----Original Message-----
> From: Dietmar Klotz [mailto:dklotz@xxxxxxxxxxx] 
> Sent: 09 December 2005 20:12
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  counting in for each
> 
> 
> I am making a list with "for each" and if the list is 1 or 3 
> items it should
> change the state of display. And I would also like to change the Icon
> depending on how many objects there are....so object 1 has 
> icon 1...object 2
> icon 2
> 
> So my question. Is it possible to count how many Items there 
> are in a node?
> And do I know where I am in a for each?
> 
> Thanks to all!
> 
> Dietmar Klotz 

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.