I have an HTML file like this:
<tr>
<td class= 'iconmenu' width="100%">...</td>
</tr>
<tr>
<td class= 'iconmenu' width="100%">...</td>
<td class= 'iconmenu'>...</td>
</tr>
The first element has one child and the second has two child, the question is:
How can I check if the first element has one child?
Counting the number of child elements of the first
tr:Counting only
tdchildren:Perform the comparison like this:
Note the use of an absolute path (starting with
/). You may be tempted to docount(//tr[1]/td). Note that this returns the count of alltdsacross every row that is the first row in every table in the document.