Reputation: 2401
For a html text
<html>
<body>
<div id="1">1</div>
<div id="2">1</div>
<div id="3">1</div>
</body>
</html>
I query
//following-sibling::div[3]
And the result is there
<div id="3">1</div>
But according to XPath specs
The following-sibling axis contains the context node's following siblings, those children of the context node's parent that occur after the context node in document order;
So what is the context node after that 3rd div is successfully found? It seems that when // founds first div, there's no 3rd div after it, the last accessible should be [2]. If the context node is not div but body or html then divs are not siblings for them.
Upvotes: 1
Views: 535
Reputation: 33618
The context node is the first text node (containing only whitespace) in the body
element.
Upvotes: 2