<div id="content">
<div class="sample1">sample text1</div>
<div class="sample2">
<span style="float:right">some text2</span>
<b>some text2</b>
</div>
<div class="sample3"> sample text <a href="#">This page</a> 3</div>
<p>paragraph 1</p>
<p>paragraph 2</p>
<div class="sample4">sample text4</div>
</div>
我想提取这些类“sample2”和“sample4”之间的数据
输出将显示这个
示例文本3
第1段
第2段
怎么回事?
答案 0 :(得分:1)
//*[
preceding-sibling::div[@class = 'sample2']
and following-sibling::div[@class = 'sample4']
]/text()