You can also search for siblings with a condition. For example immagine to need the title for a desidered language which with the two siblings tags in this XML file
<?xml version="1.0" encoding="UTF-8"?>
<IDOC BEGIN="1">
...
<PRODUCT SEGMENT="1">
<PRODUCTCODE>005</PRODUCTCODE>
<LANG>E</LANG>
<TITLE>Name</TITLE>
<LANG_ISO>EN</LANG_ISO>
</PRODUCT>
<PRODUCT SEGMENT="1">
<PRODUCTCODE>005</PRODUCTCODE>
<LANG>I</LANG>
<TITLE>Name I</TITLE>
<LANG_ISO>IT</LANG_ISO>
</PRODUCT>
...
</IDOC>
Let's break it down
<?php
"//PRODUCT" // find product tag
"//PRODUCT/LANG[.='E']" // whithin it find lang == "E"
"//PRODUCT/LANG[.='E']/../" // go up one step
"//PRODUCT/LANG[.='E']/../TITLE" // get the title Tag content
// Combined search and find siblings ----------------------------
$xml = simplexml_load_file("fname.xml");
// Search for the TITLE field which sibling is == "E" ----------
$title_E_array = $xml->xpath("//PRODUCT/LANG[.='E']/../TITLE"); // By default gives back an array of SimpleXmlElement
$title = (string) $xml->xpath("//PRODUCT/LANG[.='E']/../TITLE")[0]; // in this way saves only the value as a string
?>