question about XPath builder view

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Martin Honnen
Posts: 31

question about XPath builder view

Tue Aug 19, 2014 12:14 pm

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('<&amp;>') 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('<&amp;>') = 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: 2443

Re: question about XPath builder view

Tue Aug 19, 2014 4:57 pm

Hi,

It's not pure XPath because by default it expands predefined entity references ('&amp;' becomes simply '&'). This explains the string length equality for '<&amp;>' 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

Return to “Common Problems”

Who is online

Users browsing this forum: Bing [Bot] and 0 guests