[英]How to combine different value return by Xpath
<p class="pd-price">
<img alt="€" src="http://www.redcoon.es/templates/tpl/img/pd/pd-price/euro_small.png">
<img class="offsetStandard" alt="2" src="http://www.redcoon.es/templates/tpl/img/pd/pd-price/2.png">
<img class="offsetStandard" alt="6" src="http://www.redcoon.es/templates/tpl/img/pd/pd-price/6.png">
<img class="offsetStandard" alt="1" src="http://www.redcoon.es/templates/tpl/img/pd/pd-price/1.png">
<img class="offsetStandard" alt="-" src="http://www.redcoon.es/templates/tpl/img/pd/pd-price/minus_point.png">
</p>
How to write an Xpath for this paragraph so that it will return "€261-". 如何为此段编写Xpath,使其返回“€261-”。 the Combine String of all the alt tag.
所有alt标签的Combine String。
Use 采用
string-join(p/img/@alt, "")
that will first select the text of all alt attributes and then combine it in a string 首先将选择所有alt属性的文本,然后将其组合为字符串
在Xpath 2中,您有string-join
string-join(p[@class='pd-price']/img/@alt, '')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.