I have this simple code:
<xsl:for-each select="GroupsServed"> <xsl:value-of select="."/>,<br/> </xsl:for-each></font>
I'm trying to add a comma for each item added.
This has 2 flaws:
What do you think is the most elegant solution to solve this?
I'm using XSLT 2.0
If you're using XSLT 2.0, the canonical answer to your problem is
<xsl:value-of select="GroupsServed" separator=", " />
On XSLT 1.0, the somewhat CPU-expensive approach to finding the last element in a node-set is
<xsl:if test="position() = last()" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With