【发布时间】:2021-07-15 11:18:17
【问题描述】:
我知道这是一个常见问题(我找到了Concatenate multiple node values in xpath XPath joining multiple elements 和其他一些问题),但对于我的生活,我无法弄清楚。我有以下 HTML:
<div class="product-card__price__new"><span class="product-card__price__euros">0.</span> <span class="product-card__price__cents">69</span></div>
我需要从中提取 0.69。我尝试了以下 XPATH:
'.//*[@class="product-card__price__new"]/concat(/span/text(), following-sibling::span[1]/text)'
'.//*[@class="product-card__price__new"]/span/text()/concat(., following-sibling::span[1]/text)'
'.//*[@class="product-card__price__new"]/text()'
但我一直一无所获。提取它的正确表达式是什么?
【问题讨论】: