Hellihello
$xpath = '//CCC[@id="o"]/preceding-sibling::*';
>
> Wäre wohl das vorhergehende Geschwisterelement.
>
> <a>
> <b/>
> <c/>
> </a>
>
> wäre wohl <b> das preceeding-sibling von c?
>
> parent: könnte helfen.
Oder "/..":
~~~php
<?php
$xml_string=
'<?xml version="1.0"?>
<wurzel testattr="abc">
<testnode>
testnode_Textnode
<subnode id="abc">subnode_abc_Textnode</subnode>
<subnode id="bcd">subnode_bcd_Textnode</subnode>
</testnode>
<testnode>
test_node_2_Textnode
</testnode>
</wurzel>';
// echo $xml_string;
$simple_xml = simplexml_load_string($xml_string);
// var_dump($simple_xml);
$query_string="//subnode[@id='abc']/..";
$node_list = $simple_xml->xpath($query_string);
var_dump($node_list);
s.a. http://de.selfhtml.org/xml/darstellung/xpathsyntax.htm
Dank und Gruß,