[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Placing mark-up in between strings
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|