HTML:
<div class="article_content">
<div><img src="....jpg" alt="...">
<span class="caption">Source</span>
</div>
<p>Sub Title Text</p>
<p>Yes</p>
<p>Yes</p>
<p>Yes</p>
<p>Yes</p>
<p>Yes</p>
<p><strong>No</strong> </p>
<hr>
<p class="additional">No</p>
<ul class="menu_list">
<li><a href="...">No</a></li>
<li><a href="...">No</a></li>
</ul>
我想把所有标记为是的。
介于:
之间article[@class="article-body"]/div[@class="ctx_content"]/div[@id="article_container"]/div[@class="article_column"]/p[1]
和
//article[@class="article-body"]/div[@class="ctx_content"]/div[@id="article_container"]/div[@class="article_column"]/p/strong
答案 0 :(得分:1)
使用following-sibling
和position()
的组合检查:
//article[@class="article-body"]/div[@class="ctx_content"]/div[@id="article_container"]/div[@class="article_column"]/p[following-sibling::p/strong and position() > 1]