Re: [xsl] list with comma delimiter

Subject: Re: [xsl] list with comma delimiter
From: "Christian Rasmussen" <christiankrasmussen@xxxxxxxxx>
Date: Fri, 9 Jun 2006 13:39:39 +0200
Hi Georg,

I actually found out that this:

               <xsl:if test="position() != last()">
                   <xsl:value-of select="node()"/>
                   <xsl:text>,  </xsl:text>
               </xsl:if>
               <xsl:if test="position() = last()">
                   <xsl:value-of select="node()"/>
               </xsl:if>

works......but your example is simpler and and looks better.

Thanks a lot :-)



On 6/9/06, Georg Hohmann <georg.hohmann@xxxxxxxxx> wrote:
> <items>
>     <product>x</product>
>     <product>y</product>
>     <product>z</product>
>     <product>a</product>
> </items>

You could try this:

<xsl:for-each select="product">
   <xsl:value-of select="."/>
   <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
   </xsl:if>
</xsl:for-each>

GH

Current Thread