Replacing text within a Variable

Comments

2 comments

  • Avatar
    Nathan H.
    Try this.

    <xsl:template name="replace-string">
    <xsl:param name="text" />
    <xsl:param name="replace" />
    <xsl:param name="with" />
    <xsl:choose>
    <xsl:when test="contains($text,$replace)">
    <xsl:value-of select="substring-before($text,$replace)" />
    <b><xsl:value-of select="$with" /></b>
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="substring-after($text,$replace)" />
    <xsl:with-param name="replace" select="$replace" />
    <xsl:with-param name="with" select="$with" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    0
    Comment actions Permalink
  • Avatar
    Russ Colburn

    Son of a ! That worked! Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.