question about XPath builder view

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

question about XPath builder view

Post by Martin Honnen »

I am currently evaluating oXygen 16.0 and I have a question about the XPath builder view, it seems to me that code entered there is not treated as pure XPath, for instance when I select "XPath 3.0" as the language and evaluate the code

Code: Select all

string-length('<&>') eq string-length('<&>')
I would expect the result to be false as in pure XPath the first string has 7 characters and the second only 3. However when I run the code I get the result true. The same happens when selecting XPath 2.0.

Even with XPath 1.0 and the code

Code: Select all

string-length('<&>') = string-length('<&>')
I get the result true.

So it seems that the code is not being evaluated as pure XPath code but rather instead perhaps as XQuery code where entity references in string literals have a special meaning. Is that true? Is there a way to have pure XPath evaluation?
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: question about XPath builder view

Post by adrian »

Hi,

It's not pure XPath because by default it expands predefined entity references ('&' becomes simply '&'). This explains the string length equality for '<&>' and '<&>'.
You can change this behavior by disabling in Options > Preferences, XML > XSLT-FO-XQuery > XPath, the option "Unescape XPath expression".

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply