Page 1 of 1

search/replace an xml variable.

Posted: Thu Jan 20, 2005 7:02 pm
by nleco
hello all,
here's my problem. I have a variable that stores a string. such as:
(for the time being, ignore exact syntac, i'm going more on how to do this)

<xsl:variable name="varA">
you have %1 <a href="/somepage.php">email</a>
</xsl:variable>

i want to do a search and replace with it.
when i show this variable, i have the actual number in an xml file. I want to somehow replace "%1" with "the number from xml". i tried using the substring and substring-after/before functions. this worked except it strips out the anchor tags. the template code looks something like :

.....
<xsl:value-of select="substring-before($string, '%')" />
<xsl:value-of select="xml/path/to/number" />
<xsl:with-param name="string" select="substring(substring-after($string, '%'), 2)" />
......

any ideas???