Here’s an exapmle of xml I’m dealing with:
<div>
<div>
<table id="table1">
<div>
<table id="table2"/>
</div>
</table>
</div>
</div>
I want to create an XPath expression, which would select table1 and would not select table2. The ids are there for example and are not present in the original document. The structure of those documents may be much more convoluted as well. I want to select the top table for processing.
Is it possible to do this with XPath alone?
This will work even for multiple “top-level” tables: