Blogger :
Geekswithblogs.net
All posts :
All posts by Geekswithblogs.net
Category :
XSL/T
Blogged date : 2008 Apr 01
Here's a sample template that lets you have the String.Replace() functionality in XSLT 1.0. The template "string-replace-all" takes 3 parameters and recursively processes the input text string.
- text : main string
- replace : the string fragment to be replaced
- by : the replacement string

Here's how it is called:

The resulting value of $myVar after {ReplaceMe} is replaced is "This is a sample text : String.Replace() in XSLT and String.Replace() in XSLT"
For those who are not familiar with XSLT syntax and here's the C# equivalent. An excellent material for the thedailywtf! :)

(Note: I'm not so sure, but I think in XSL 2.0 there is already a built-in replace function on strings)
