I have the following HTML:
<table>
<tbody>
<tr class="Menu indent0 picker-parent open"></tr>
<tr class="divider MenuGroup"></tr>
<tr class="MenuGroup closed indent1 picker-parent"></tr>
<tr class="MenuGroup indent1 picker-parent open"></tr>
<tr class="divider MenuGroup"></tr>
---><tr class="MenuItem indent2 picker-parent"></tr>
---><tr class="MenuItem indent2 picker-parent"></tr>
---><tr class="MenuItem closed indent2 picker-parent"></tr>
---><tr class="MenuItem closed indent2 picker-parent"></tr>
<tr class="divider MenuGroup"></tr>
</tbody>
</table>
I need to select all tr
tags with the class 'MenuItem' between the 2nd and third tr
tags with the class 'divider'.
I understand generally how to select tags by class with the following generic syntax from this question:
//*[contains(concat(" ", normalize-space(@class), " "), " foo ")]
But I'm unsure how to combine it with the syntax provided in this answer.
Ex.: select all '''p''' tags that have only one preceding sibling '''divider''' tag)
/*/p[count(preceding-sibling::divider)=1]
My attempt so far is invalid:
//*/tbody/tr[count(preceding-sibling::[contains(concat(" ", normalize-space(@class), " "), " divider")])=2]