Subject: Re: [xsl] Placing mark-up in between strings From: Jeff Sese <jsese@xxxxxxxxxxxx> Date: Thu, 23 Nov 2006 16:53:39 +0800 |
Hi,
I have this function (thanks to sir M. Kay) that search and replaces all occurrences of a sequence of search string with its corresponding replacement string.
<xsl:function name="ati:replace-all">
<xsl:param name="input" as="xs:string"/>
<xsl:param name="words-to-replace" as="xs:string*"/>
<xsl:param name="replacement" as="xs:string*"/>
<xsl:sequence select="if (exists($words-to-replace)) then ati:replace-all(replace($input, $words-to-replace[1], $replacement[1]),remove($words-to-replace,1),remove($replacement,1)) else $input"/>
</xsl:function>
Can this be modified so that I can place the search string inside an element and the replacement string inside an attribute?
I have this as a sample:
<p>This is supposed to be my input string with search1, search2, and search3.</p>
I want this to be:
<p>This is supposed to be my input string with <replacement value="replacement1">search1</replacement>, <replacement value="replacement2">search2</replacement>, and <replacement value="replacement3">search3</replacement>.</p>
Thanks, Jeff
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Placing mark-up in between st, Jeff Sese | Thread | Re: [xsl] Placing mark-up in betwee, David Carlisle |
[xsl] Placing mark-up in between st, Jeff Sese | Date | Re: [xsl] Placing mark-up in betwee, Florent Georges |
Month |