我有下表
<table>
<tbody>
<tr>
<td>First Row | First Column</td>
<td>First Row | Second Column</td>
</tr>
<tr>
<td>Second Row | First Column</td>
<td>Second Row | Second Column</td>
</tr>
<tr>
<td>Third Row | First Column</td>
<td>Third Row | Second Column</td>
</tr>
<tr>
<td>Forth Row | First Column</td>
<td>Forth Row | Second Column</td>
</tr>
<tr>
<td>Fifth Row | First Column</td>
<td>Fifth Row | Second Column</td>
</tr>
<tr>
<td>Sixth Row | First Column</td>
<td>Sixth Row | Second Column</td>
</tr>
</tbody>
我需要使用xpath expresion来接收分组的3条记录:
如何仅使用xpath 1.0来实现这一目标?
答案 0 :(得分:0)
在这里, xpath 表达式:
concat(//tr[1]/td[2], ' , ', //tr[2]/td[2], codepoints-to-string(10), //tr[3]/td[2], ' , ', //tr[4]/td[2], codepoints-to-string(10), //tr[5]/td[2], ' , ', //tr[6]/td[2])
以上将返回以下字符串:
First Row | Second Column , Second Row | Second Column
Third Row | Second Column , Forth Row | Second Column
Fifth Row | Second Column , Sixth Row | Second Column