xsl-list
[Top] [All Lists]

RE: [xsl] invalid escape sequence: \b

2008-09-29 16:26:19
The \b escape sequence is not available in the regex dialect defined for use
in the XML Schema and XPath/XSLT specifications. I think the reason for this
is that the concept of a "word boundary" is too difficult to define in a
language-independent way. 

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Tony Zanella [mailto:tony(_dot_)zanella(_at_)gmail(_dot_)com] 
Sent: 29 September 2008 20:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] invalid escape sequence: \b

Hello all,
I'm using oXygen 9.3 to write a template that uses a regular 
expression as an argument for the xslt function matches().  
While writing the regex, I used oXygen's onboard find/replace 
with the option for regular expression selected to test for 
what I wanted. I managed to get the following regex working 
on some test data:

[IVXMDC]\b

For example, given the following three lines:

VI
Pt. XXIV
Chapter II. CHARITABLE EFFORT
II: England

The regex matches on all and only the roman numerals when I 
just use oXygen's find/replace.

But when I try to plug this into an xsl instruction:

<xsl:if test="not(matches(.,'[IVXMDC]\b'))">
         <xsl:value-of select="lower-case(.)"/>
      </xsl:if>

I get the following error:

Description: Error at character 10 in regular expression
"[IVXMDC]+\b": invalid escape sequence

...and running the template breaks things. Searching the 
forums, I found this thread:

http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/a
rchives/200801/msg00304.html

from which I gathered that I might try to remove the 
backslash and see if the transformation worked. But doing 
that didn't work. Nor did escaping the backslash with another 
backslash.

Thanks in advance for any tips. And sorry if this isn't the 
right forum for this post.
Tony

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>