Erik's Misadventures on BizTalk, .NET and Life

[ vb .. C# .. F# ] |> List.filter(fun lang -> isBothElegantAndPowerful lang)
posts - 18, comments - 40, trackbacks - 1

My Links

News



Archives

Image Galleries

BizTalk Server

F#

String.Replace() in XSLT

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)

Print | posted on Tuesday, April 01, 2008 8:36 PM |


Feedback

# re: String.Replace() in XSLT

nice xslt! 7/31/2008 2:09 AM | al

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 4 and 3 and type the answer here:

Powered by: