1

Assuming I have just used an XPath query to get the 5th instance of the bookelement in a sample xml file that looks something like this:

<books>
<book id=1></book>
<book id=2></book>
<book id=3></book>
...etc
</books>

How can I get the next 10 bookelements after the one I've just queried? I'm using PHP and XML DOM.

Dewgong
  • 67
  • 1
  • 5

1 Answers1

2
following-sibling::book[position() <= 10]
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • Does he need to use the current node as the context like: `$xpath->query('following-sibling::book[position() <= 10]', $currentBookNode);`? – prodigitalson Dec 02 '10 at 07:03