1
<span class="description">
3
<div class="descriptionheading">Overview</div>
4
This example shows how we can change the context node for the XPATH processing so that it executes from another node than the root node.
6
<div class="descriptionheading">Context Nodes</div>
7
In PHP the XPATH engine uses the root node as the default context node.<br/><br/>
8
In newer versions of PHP we can add an optional context node from the document which allows us to execute a query from
9
any node in the document.<br/><br/>
10
In this case we use <span class="interestingdescription">$node</span> as the context node and thus are executing ./color for each car, and not for the root of the document.
12
<div class='exampleheading'>Web Page Output:<br><br>
13
<img src='DomExample3b.png'>
b'\\ No newline at end of file'