I just spent far too much time chasing this one....
When running an xpath query on a table be careful about table internal nodes (ie: <tr></tr>, and <td></td>). If the master <table> tag is missing, then query() (and likely evaluate() also) will return unexpected results.
I had a DOMNode with a structure like this:
<td>
<table></table>
<table>
<tr>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</td>
Upon which I was trying to do a relative query (ie: <?php $xpath_obj->query('my/x/path', $relative_node); ?>).
But because of the lone outer <td></td> tags, the inner tags were being invalidated, while the nodes were still recognized. Meaning that the following query would work:
<?php $xpath_obj->query('*[2]/*[*[2]]', $relative_node); ?>
But when replacing any of the "*" tokens with the corresponding (and valid) "table", "tr", or "td" tokens the query would inexplicably break.