title: How to use following-sibling xpath query with php?
body: <p>XML:</p>
  
  <pre><code>&lt;Routes&gt;
    &lt;Route type="source" &gt;
     &lt;Table&gt;
       &lt;Tablename&gt;incoming&lt;/Tablename&gt;
       &lt;Fields&gt;
         &lt;Fieldsname ref="dest"&gt;truegoto&lt;/Fieldsname&gt;
       &lt;/Fields&gt;
     &lt;/Table&gt;
    &lt;/Route&gt;
  &lt;/Routes&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$doc    = new SimpleXMLElement('routingConfig.xml', null, true);
  $foo = $doc-&gt;xpath('/Routes/Route[@type="source"]/Table/Tablename[incoming]/following-sibling::Fields/Fieldsname[@ref="dest"]');
  print_r($foo);
  </code></pre>
  
  <p>Trying  to get <code>truegoto</code> by way of knowing <code>&lt;Tablename&gt;incoming&lt;/Tablename&gt;</code>. My current code just returns an empty array : /</p>