Creating a comma delimited list with xslt

I needed to create a comma delimited list from xslt. Here is 2 ways to do it:

<!– Add the comma to each item but the last –>
<xsl:for-each select=TagName>
  <xsl:value-of select=. />
  <xsl:if test=position() != last()>
    <xsl:text>, </xsl:text>
  </xsl:if>
</xsl:for-each>

Comments are closed.