[xml] proximity position in libxml2's xmlXPathEvalExpression()

Consider the following XML document:

<test><!-- a --><somenode><!-- b --></somenode><!-- c --></test>

and let libxml2 evaluate the XPath expression "//comment()" on it.
libxml2 returns node-set (a,c,b) instead of (a,b,c), that I would have
expected. To be exact, "(//comment())[2]" gives singleton (c) instead of
the expected (b).
W3C's XPath recommendation indeed states, that predicates are to
determine "the position of the node in the node-set ordered in document
order if the axis is a forward axis" [1], which should be the case here.

Don't hesitate to call me a fool for this stupid-looking question, I
probably just got something terribly wrong, right?


[1] http://www.w3.org/TR/xpath.html#predicates

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