php xpath - get node position
<p>I have the following stripped down php code...</p>

<pre><code>foreach ($xpath-&gt;query('/html/body//a')} as $queryitem) {
   $nodeposition = ???;
   $parentposition = ???;
}
</code></pre>

<p>...from this is it possible to find the position of each node and the position its parent? </p>

<p>for example:</p>

<p><code>0..&lt;html&gt;</code><br />
<code>1....&lt;head&gt;</code><br />
<code>2......&lt;title&gt;</code><br />
<code>3......&lt;meta&gt;</code><br />
<code>4......&lt;meta&gt;</code><br />
<code>5....&lt;body&gt;</code><br />
<code>6......&lt;div&gt;</code><br />
<code>7........&lt;a&gt;</code> </p>

<p>This would produce a kind-of ID for each tag and the ID of the parent tag which it joins to.</p>

<p>So the results would be = 0|,1|0,2|1,3|1,4|1,5|0,6|5,7|6</p>
