Re: [xsl] regex error in saxon8.9n?

Subject: Re: [xsl] regex error in saxon8.9n?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 17 Jul 2007 10:35:44 +0200
Hi Erik,

Just to find out what this expression is all about, I took the liberty to simplify it a bit. I wasn't aware of character class subtraction, and I thought it was not allowed, but like you pointed out, it is:

replace('abel', '[a-z-[b]', '-')

means: replace all characters in the range a-z, *except* the range [b], returning '-b--'. The square brackets are necessary to specify a valid character class. Any class is allowed and subtractions can be nested. The link you pointed to 'clearly' (uhuh, if you can read BNF easily) explains this possibility.

In short: .NET is wrong and Java version of Saxon is correct.

Cheers,
-- Abel Braaksma

PS: I think it is better to ask saxon specific questions at the saxon list: https://lists.sourceforge.net/lists/listinfo/saxon-help


Erik Wilde wrote:
hello.

in my xipr implementation of xinclude in xslt 2.0 (available at http://dret.net/projects/xipr/), i use regexes to parse xpointers. this works fine for me in saxon 8.9j, but seems to cause errors in saxon 8.9n, at least this is what i suspect. when using the current version of xipr (id 297), saxon 8.9n produces the following error messages:


Error at xsl:when on line 88 of file:///d:/temp/xipr.xsl: FORX0002: Error at character 5 in regular expression "^[\i-[:]][\c-[:]]*$": character must be escaped ([)


Error at xsl:when on line 92 of file:///d:/temp/xipr.xsl: FORX0002: Error at character 14 in regular expression "^element\([\i-[:]][\c-[:]]*((/...": character must be escaped ([)

Failed to compile stylesheet. 2 errors detected.


running xipr with saxon 8.9j works fine. i think that the above message is wrong and that the regex and saxon 8.9j are right, but there definitely is a regex parsing problem in one of the two saxon versions. it is my understanding that the xipr regexes are correct because of the following construct in the xpath 2.0 regex syntax:


http://www.w3.org/TR/xmlschema-2/#nt-charClassSub

please cc me when replying to this post! thanks a lot! kind regards,

erik wilde   tel:+1-510-6432253 - fax:+1-510-6425814
       dret@xxxxxxxxxxxx  -  http://dret.net/netdret
       UC Berkeley - School of Information (iSchool)

Current Thread