Hi,
I can suggest 2 approaches.
1) Add template rule for "childtag1":
Code:
<xsl:template match="childtag1">
<xsl:value-of select="."/>
<xsl:if test="following-sibling::childtag1">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:template>
2) or change the code you posted like this:
Code:
<xsl:template match='tag1'>
<test1>
<xsl:for-each select="childtag1">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
</test1>
</xsl:template>
Just for this example the second is more intuitive and readable and finally faster I think.
Regards,
Armen