0

我试图在两个评论之间选择节点

<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选择吗?

4

1 回答 1

0

试试这个xpath

//option[preceding-sibling::comment()=" fromHere " and following-sibling::comment()=" toHere "]
于 2013-06-07T08:17:52.143 回答