I'm trying to find all the tables below my current node without also including the nested tables. In other words, if I have this, i want to find "yes" and not "no":
<table> <!-- outer table - no -->
<tr><td>
<div> <!-- *** context node *** -->
<table> <!-- yes -->
<tr><td>
<table> ... </table> <!-- no -->
</td></tr>
</table>
<table> <!-- yes -->
<tr><td>
<table> ... </table> <!-- no -->
</td></tr>
</table>
</div>
</td></tr>
</table>
Is there any easy way to do this in XPath 1.0? (In 2.0, it'd be .//table except .//table//table
, but I don't have a 2.0 as an option.)
EDIT: please, the answers so far are not respecting the idea of current context node. I don't know how far down the first layer of table might be (and it might differ), and I also don't know if I might be inside another table (or two or three).
Literally, I want what .//table except .//table//table
in XPath 2.0 would be, but I have only XPath 1.