我想选择其祖先为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 & Security (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 & Security (1028)
Geotechnologies (96)
答案 0 :(得分:1)
这个怎么样:
//td[preceding-sibling::td[1]/input]/text()