Altova Mailing List Archives

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

From: Abel Braaksma <>
Date: 7/17/2007 8:36:00 AM
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.

-- Abel Braaksma

PS: I think it is better to ask saxon specific questions at the saxon 

Erik Wilde wrote:

in my xipr implementation of xinclude in xslt 2.0 (available at, 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 

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:

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  -
       UC Berkeley - School of Information (iSchool)


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.