This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
position in a conditional for-each
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] position in a conditional for-each
- From: "James Piva" <james dot piva at ndexsystems dot com>
- Date: Wed, 3 Jan 2001 15:25:37 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi,
I'm trying treat the last element that passes a
condition in a for-each differently.
Every element which passes the condition
displays its value, and that is followed by
a comma. The problem is that I can't know when
the last element to meet the condition
has passed.I would like to omit trailing comma.
<xsl:for-each select="COOLJEX_ATTRIBUTE">
<xsl:if test="@key='true'">
<xsl:value-of select="@name"/>
<xsl:text> , </xsl:text>
</xsl:if>
</xsl:for-each>
The only solution I can think of is to create a
stringBuffer which is updated each time through the
condition, then create a substring of that for display.
But I don't know how to create a 'local variable'. I've
looked at the xsl:attribute, but have not quite understood its
functions.
please help,
thank you
james
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list