Re: XPath question
| From: | Eli | Date: | Mon, 05 Feb 2007 13:25:59 +0000 |
| Subject: | Re: XPath question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248330@lists.php.net to get a copy of this message | ||
Eli wrote:
Hi,
<ns:root i="0">
<tag>
<ns:node i="1"/>
</tag>
<ns:anothernode i="2">
<ns:notme i="3">
<ns:meneither i="4"/>
</ns:notme>
<anothertag/>
</ns:anothernode>
</ns:root>
I need to retrieve a list of all the INNER <ns:*> nodes (not the root i=0 node), that do not have an ancestor of any <ns:*> node but the root <ns:root i="0"> node.
In other words: get all <ns:*> nodes with i in {1,2}.
Solved. :-)
$XPathQuery = /*//ns:*[not(ancestor::ns:*[ancestor::ns:*])]
-thanks