Tuesday, July 04, 2006
XSLT Replace Template
<xsl:template name="replace">
<xsl:param name="string" select="." />
<xsl:choose>
<xsl:when test="not($string)" />
<xsl:when test="contains($string, ';')">
<xsl:value-of select="substring-before($string, ';')" />
<br />
<xsl:call-template name="replace">
<xsl:with-param name="string" select="substring-after($string, ';')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
<br />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
All you need do is call the template and pass your input into with $string param, in my case this was the ";". Then replace the <br/> tags with whatever you need to replace your input string with - easy!
No comments:
Post a Comment