% <abc>
% 23 45 67 2 123
% </abc>
%
% I wish to display these values comma separated
%
% 23; 45; 67; 2; 123
Those are semi-colons, not commas. To do this in XSLT, you need to
create a recursive template. The approach is to create a template which
takes two arguments, s and t. If the s is zero-length, the template
emits t. Otherwise, it builds new arguments, moving the first word of s
to the end of t, and calls itself.
<xsl:template match="abc">
<xsl:call-template name="semi-colonify">
<xsl:with-param name="s" select="string(.)"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="semi-colonify">
<xsl
aram name="s"/>
<xsl
aram name="t"/>
<xsl:choose>
<!-- s is not zero-length, so split it -->
<xsl:when test="$s">
<xsl:call-template name="semi-colonify">
<xsl:with-param name="t">
<!-- need to fiddle if there's already a t -->
<xsl:if test="$t">
<xsl:value-of select="$t"/>
<xsl:text>; </xsl:text>
</xsl:if>
<xsl:variable name="sbs" select="substring-before($s, ' ')"/>
<xsl:choose>
<xsl:when test="$sbs">
<xsl:value-of select="$sbs"/>
</xsl:when>
<xsl
therwise>
<xsl:value-of select="$s"/>
</xsl
therwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="s" select="substring-after($s, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl
therwise>
<xsl:value-of select="$t"/>
</xsl
therwise>
</xsl:choose>
</xsl:template>
XSLT can handle most string processing problems, but you may find
it's easier to use another language. You have to balance portability
requirements against your ability to be productive. For instance,
this could be done with Rexx:
<rexx:function name='my:semi-colonify' all-strings='yes'>
return changestr(' ', arg(1), '; ')
</rexx:function>
<xsl:template match="abc">
<xsl:value-of select='my:semi-colonify(.)'/>
</xsl:template>
Something similar can likely be done equally portably using python or
a bit more portably using ecma script.