How to use
      fn:replace(string,pattern,replace) 
in XSLT
is it like < fn:replace(...)/>??
The function is specified as follows:
fn:replace($input, $pattern, $replacement, [$flags])
$input        xs:string?  the string to change
$pattern      xs:string   regular expression to match the areas to be replaced
$replacement  xs:string   the replacement string
$flags        xs:string   flags for multiline mode, case insensitivity, etc
return value  xs:string
Note that $pattern is a regular expression, and the replacement string also has some special substitution syntax.
Here are some examples:
# simple replacement
replace('query', 'r', 'as')               queasy
# character class
replace('query', '[ry]', 'l')             quell
# capturing group substitution
replace('abc123', '([a-z])', '$1x')       axbxcx123
# practical example
replace('2315551212',                     (231) 555-1212
    '(\d{3})(\d{3})(\d{4})',
    '($1) $2-$3'
)
fn:replace
fn:replace, Flags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With