based on this HTML:
< table width='300' ......>
<tbody>
< tr>
< td class = 'wcheader1'> ..... </td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
< tr>
< td class = 'wcheader1'> ..... </td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
< tr>
< td class = 'wcheader1'> ..... </td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
< tr>
< td class = 'wccontnetbox'>......< /td>
< /tr>
</tbody>
</table>
I have trouble selecting only the first two <td class='wccontnetbox'> elements after the first <td class='wcheader1'> element. Is there an XPath expression to do this?
UPDATE: those elements are dynamic.
Use the following expression to select the first two
wccontnetboxelements after the firstwcheader1:I’m using
//because you don’t show your full input. It would be better to use a direct path to the table (e.g./html/body/<etc>/table...).Use the following expression to select all nodes between the first and second
wcheader1elements:Note: This second expression uses the Kayessian node-set intersection formula. In general, use the following expression to find the intersection of
$set1and$set2: