Re: [xsl] Trying to replace vertical pipe...

Subject: Re: [xsl] Trying to replace vertical pipe...
From: Lars Huttar <lars_huttar@xxxxxxx>
Date: Thu, 26 Aug 2010 12:43:38 -0500
 On 8/26/2010 11:53 AM, Paul Harvey wrote:
> Hmm, get "invalid escape character" when doing that...

Can you show us your code?
The following is an example of what David was talking about.
        <xsl:value-of select="replace('a|95|a', '\|95\|', 'x')"/>

I tested it and it works, no errors.

This is not a matter of escaping for strings (note the first argument to
replace() doesn't need it), but of escaping for regexps.
Pipe is a special character for regexps, not for string literals.

Lars

>
> ----- Original Message ----
> From: David Carlisle <davidc@xxxxxxxxx>
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: Paul Harvey <paul_harv_2@xxxxxxxxx>
> Sent: Thu, August 26, 2010 12:35:35 PM
> Subject: Re: [xsl] Trying to replace vertical pipe...
>
> On 26/08/2010 17:26, Paul Harvey wrote:
>> I'm sure I can't be the first to face this, but have been unable to track down 
>> a
>> solution...
>>
> use \| to quote |

Current Thread