Re: [xsl] Placing mark-up in between strings

Subject: Re: [xsl] Placing mark-up in between strings
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Nov 2006 15:01:31 GMT
> Are you sure these are the only characters to escape? 

They are all the ones that can be escaped with \

which includes - so I put it in although you don't need to escape it
really as it's only special in [a-z] and if you have already escaped [
and ] then - will never be taken to be a character range.

> And '$'?

which reminds me I didn't include the special characters added in xpath
regex, so yes you need to add $ (but that's the only one)

so corrected function is

 <xsl:function name="f:escape">
   <xsl:param name="s" as="xs:string"/>
   <xsl:sequence select="replace($s,'[\\\|\.\-\^\?\*\+\(\)\{\}\[\]\$]','\\$0')"/>


Current Thread