0

我想选择其祖先为 td 的节点的文本,并将输入标记作为子节点:

输入是:

<tr>
    <td width="1"><input type="checkbox" name="marketCodes" value="AE01" onclick="facetCheckboxClicked(this)"></td>
    <td style="padding-left:5px;padding-right:5px;">Defense &amp; Security&nbsp;(1028)</td>
    <td width="1"><input type="checkbox" name="marketCodes" value="AE02" onclick="facetCheckboxClicked(this)"></td>
    <td style="padding-left:5px;padding-right:5px;">Geotechnologies (96)</td>
    <td style="padding-left:5px;padding-right:5px;">Aircraft Products & Services (594)</td>
</tr>

预期输出为:

 Defense &amp; Security&nbsp;(1028)
 Geotechnologies (96)
4

1 回答 1

1

这个怎么样:

//td[preceding-sibling::td[1]/input]/text()
于 2012-09-25T06:52:26.867 回答