xsl-list
[Top] [All Lists]

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

2010-08-26 12:43:50
 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(_at_)nag(_dot_)co(_dot_)uk>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: Paul Harvey <paul_harv_2(_at_)yahoo(_dot_)com>
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 |



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--