1--TEST--
2XPath: with a context node
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$dom = new DOMDocument();
8$dom->loadXML(<<<XML
9<root>
10    <child>
11        <p>bar</p>
12    </child>
13    <child>
14        <p>foo1</p>
15        <p>foo2</p>
16    </child>
17</root>
18XML);
19$xpath = new DOMXpath($dom);
20
21foreach ($xpath->query("p", $dom->documentElement->firstElementChild->nextElementSibling) as $p) {
22    echo $p->textContent, "\n";
23}
24
25var_dump($xpath->evaluate("count(p)", $dom->documentElement->firstElementChild->nextElementSibling));
26
27?>
28--EXPECT--
29foo1
30foo2
31float(2)
32