I had a case recently where I had to remove a trailing comma from an incoming value within a feed. The trimming had to be done in XSL and the string was not being assembled within a for-each loop, so I needed a simple way to remove the last ‘,’. Here’s two lines that do the trick. I posted this because I didn’t find it via Google – what I found were solutions to ‘not’ add a comma after the last concatenation within a for-each.
<xsl:variable name="len" select="string-length(normalize-space(atom:feed/atom:entry/atom:content/atom:properties/atom:MyCommaSeparatedString))-1"/> <xsl:value-of select="substring(atom:feed/atom:entry/atom:content/atom:properties/atom:MyCommaSeparatedString, 1, $len)"/>