PDA

View Full Version : XSL display until eof


Lola Vavoom
07-16-2009, 03:59 AM
Hi,
I'm very, very new to this hence this question.

I need to read and display a list of items separated by a "/" until the last item which has no separator.
The items are listed in xml:
<parent_tag><child_tag>item1</child_tag></parent_tag>
<parent_tag><child_tag>item2</child_tag></parent_tag>
<parent_tag><child_tag>item3</child_tag></parent_tag>

and I can manage to display the above as:
item1/item2/item3/

but I need to lose that "/" after item3. Does anyone know of a simple way to do this ?


thanks in advance.

Lola Vavoom
07-16-2009, 06:22 AM
In case anyone else needs similar, do

<xsl:for-each select="whatever">

<xsl:value-of select="whatever">

<xsl:if test="position() &lt; last()">
<xsl:text>/</xsl:text>
</xsl:if>

<xsl:if test="position() = last()">
<xsl:text></xsl:text>
</xsl:if>

</xsl:for-each>