xsl-list
[Top] [All Lists]

Re: [xsl] list with comma delimiter

2006-06-09 04:42:07
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(_dot_)hohmann(_at_)gmail(_dot_)com> 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

--~------------------------------------------------------------------
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>