I have XML documents, for example:
<rootelement> <myelement>test1</myelement> <myelement>test2</myelement> <myelement type='specific'>test3</myelement> </rootelement>
I would like to get specific myelement and if which it does not represent , and then the first one. Therefore, I write:
/rootelement/myelement[@type='specific' or position()=1]
the XPath specification states of 'or expression', which:
The correct operand is not evaluated if the left operand is evaluated as true
The problem is that libxml2-2.6.26 seems to apply the union of both expressions, returning a "2 Node Set" (for example, using xmllint --shell ).
Is it libxml2, or am I doing something wrong?
xpath union libxml2
foudfou
source share