Put a comma with conditions in XSL

M

Matt

I want to produce item1, item2, item3, etc... in HTML. i.e. it has
commas between the items.

In XSL, I do the following, but it don't display anything

<xsl:if test=<xsl:number/> &gt; 1>,</xsl:if>
<xsl:value-of select="item"/>

any ideas? please advise. thanks!!
 
B

Ben Edgington

I want to produce item1, item2, item3, etc... in HTML. i.e. it has
commas between the items.

In XSL, I do the following, but it don't display anything

<xsl:if test=<xsl:number/> &gt; 1>,</xsl:if>
<xsl:value-of select="item"/>

Wow, that's completely mangled 8^)

Try something like

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

[untested!]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top