Project

Profile

Help

XPath 1.0 incompatibility

Added by Anonymous over 14 years ago

Legacy ID: #8387754 Legacy Poster: Claudio Tasso (tassoc)

Hi, I'm using the latest version of saxon HE and I encountered an error evaluating the following XPath expression: position() = 1 = 1 this is a valid expression according XPath 1.0 (XMLSpy and Xerces do not raise any errors), but using Saxon an exception occurs: [i]Exception in thread "main" net.sf.saxon.trans.XPathException: XPath syntax error at char 12 in {position()=1=1}: Unexpected token "=" beyond end of expression [/i] I know that this expression is not valid according to XPath 2.0, but I've enabled backwards compatibility option on XPathEvaluator class, so I expect that it should work. Does any other option exist that let this expression evaluated without errors? Thanks in advance


Replies (1)

RE: XPath 1.0 incompatibility - Added by Anonymous over 14 years ago

Legacy ID: #8387793 Legacy Poster: Michael Kay (mhkay)

This incompatibility is documented at http://www.w3.org/TR/xpath20/#id-incompat-in-true-mode as one of the few things where an XPath 2.0 processor does not implement something that worked in XPath 1.0, even with backwards compatibility enabled. The reason for this is that the construct is so error-prone: its meaning as defined in XPath 1.0 is not what any rational user would expect (except possibly in cases where the expression takes the form in your example, X = Y = 1, where it means the same as X = Y). Saxon provides an XPath 2.0 processor conforming to the XPath 2.0 specification, it does not attempt to provide an XPath 1.0 processor. Sorry!

    (1-1/1)

    Please register to reply