Strange XPath Behaviour
Issues related to W3C XQuery.
-
- Posts: 15
- Joined: Mon Dec 16, 2019 3:01 pm
Strange XPath Behaviour
Hello,
In Oxygen 25 and 26 we encountered a strange behavior when evaluating an xpath expression with the XPath/XQuery builder.
We want to select all attributes in the entire document except the first attribute of each element with this expression:
The result is confusing. It selects the first attributes except for the image element in line 13 (blue arrow).
I have tested the expression at https://www.videlibri.de/cgi-bin/xidelcgi with the same input file.
It gives the expected result there:
Thanks in advance and regards
Jörn
In Oxygen 25 and 26 we encountered a strange behavior when evaluating an xpath expression with the XPath/XQuery builder.
We want to select all attributes in the entire document except the first attribute of each element with this expression:
Code: Select all
//@*[position()>1]
OxygenScreenshot.png
I have tested the expression at https://www.videlibri.de/cgi-bin/xidelcgi with the same input file.
It gives the expected result there:
grafik.png
Could this be a bug? Or can you explain the result the XPath builder in Oxygen returns here?Thanks in advance and regards
Jörn
You do not have the required permissions to view the files attached to this post.
-
- Posts: 143
- Joined: Tue Mar 25, 2003 11:21 am
Re: Strange XPath Behaviour
Hello Jörn,
Please consider using the XPath 3.1 SA engine from the drop-down menu instead of XPath 3.1.
The results should be as expected.
Regards,
Mircea
Please consider using the XPath 3.1 SA engine from the drop-down menu instead of XPath 3.1.
The results should be as expected.
Regards,
Mircea
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Strange XPath Behaviour
Hello,
It seems that the position() function take into account also the default attributes from the schema, even they are not in the document. For example in the "concept" element you have the 4 attributes: class, ditaarch:DITAArchVersion, domains, and id. You can use the following XPath expression "//concept/@*/name()" to get the list of attributes for the "concept" element.
Therefore, in your example the id attribute is on position 4, and this is why is returned by the XPath expression. When "XPath 3.1 SA engine" is used, the default attributes are returned as last attributes in the list.
Best Regards,
Octavian
It seems that the position() function take into account also the default attributes from the schema, even they are not in the document. For example in the "concept" element you have the 4 attributes: class, ditaarch:DITAArchVersion, domains, and id. You can use the following XPath expression "//concept/@*/name()" to get the list of attributes for the "concept" element.
Therefore, in your example the id attribute is on position 4, and this is why is returned by the XPath expression. When "XPath 3.1 SA engine" is used, the default attributes are returned as last attributes in the list.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service