I am trying to get table rows from XHTML using XPath / XSLT. My xhtml example looks like this:
<body> <....> <table> <tbody> <tr> <td/> <td/> <td> <table> <tr> <....> </tr> </table> </td> </tr> </tbody> </table> </body>
In the above structure, <tbody> may or may not be. Tables can be nested at any level. Now I want to get all the rows for this table. Therefore, when I process the outer table, I want to get only the outer row (containing 3 tds), but not the inner tr (inside the nested table). How can I do this using XSLT or XPath?
Edit: what I'm looking for is a way to get all descendants :: y for node x, but y should not be a descendant of another x. The path from x-> y must not contain another x. I may not have anything that distinguishes outer x from inner x.
Note. I try to do this with many HTML files that have different structures, and I cannot change the structure of any HTML file - I have been given this. The only thing is that they all formed XHTML well.
Thank you for your help.
source share