[xml] relative xpath matches nodes anywhere in tree

So apparently when libxml2 evaluates an XPath expression that is
relative it searches everywhere in the tree, as if the expression
started with "//". For instance

~/tmp$ cat test.xml
<?xml version="1.0"?>
~/tmp$ xmllint --xpath y test.xml

My understanding of XPath says that "y" matches all the child elements
of the context node named y. Since the context is the root, this
should match no elements. What's going on here?

PS this came up because of an XMLStarlet bug report:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]