Dear Basex-team members,
I'm a PHD-researcher at the University of Antwerp. For one of the courses I assist we are planning to use BaseX in order to learn students the concepts of Xpath and XQuery. We find that the tool is a good way to illustrate things but I found an error.
In attachment I've put the XML file I was testing. It's about students, and it's a very small example file. After importing this file, I want to execute the following XPath expression:
/child::students/child::student/child::*/ancestor::*
This works well as it gives me all the ancestors namely both 'Student' elements and the 'Students' element. But, when I add the following predicate (see bold part in the expression below) it goes wrong:
/child::students/child::student/child::*/ancestor::*[position()=1]
What should happen according the XPath rules is: give back the first ancestor. Now, the result of 'ancestor::* is (in reverse document order)
the right Student element , the left Student element, Students element
The second of this is the left student element. But when you execute this, the result that I get are the TWO student elements, with is wrong. If we change the position to 2, I get the StudentS element, which is also wrong.
Is it possible to solve this problem?
Further I also have some thought about making the GUI better. It should be good to make a distinction between element nodes, attribute nodes and text nodes in the visual presentation of the XML tree. That makes things much clear for users.
If you have further questions regarding this mail, please send them and I'll answer as soon as possible.
Thanks in advance!
Kind regards,
--
Tayena Hendrickx
Member of the Research Group
Advanced Database Research and Modelling (ADReM)
University of Antwerp (UA)
Department of Mathematics and Computer Science
Campus Middelheim (CMI), Building G, Office G2.33