[Home] [By Thread] [By Date] [Recent Entries]
pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
Hello everybody, Your subject says XSLT 1.0 so here is an XSLT 1.0 approach: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template name="replace"> <xsl:param name="text"/> <xsl:param name="char" select="','"/> <xsl:choose> <xsl:when test="not(contains($text, $char))"> <xsl:value-of select="$text"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before($text, $char)"/> <xsl:comment> <xsl:value-of select="$char"/> </xsl:comment> <xsl:text> </xsl:text> <xsl:call-template name="replace"> <xsl:with-param name="text" select="substring-after($text, $char)"/> <xsl:with-param name="char" select="$char"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="mytext">
<xsl:copy>
<xsl:call-template name="replace">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:copy>
</xsl:template></xsl:stylesheet> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



