xsl-list
[Top] [All Lists]

RE: counting in for each

2005-12-11 09:22:48
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(_at_)cellular(_dot_)de] 
Sent: 09 December 2005 20:12
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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 





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>