我试图在两个评论之间选择节点
<ul>
<!-- fromHere -->
<option>a</option>
<option>a</option>
<option>a</option>
<option>a</option>
<option>a</option>
<!-- toHere -->
<option>a</option>
<option>a</option>
<option>a</option>
<option>a</option>
</ul>
$x("//comment()[.=' fromHere ']/following-sibling::* | //comment()[.=' toHere ']/preceding-sibling::*")
有没有进行AND选择?
答案 0 :(得分:0)
试试这个xpath
:
//option[preceding-sibling::comment()=" fromHere " and following-sibling::comment()=" toHere "]