使用此XPath表达式:
translate(
concat(//span[@itemprop = 'price']/text()[normalize-space()],
//span[@itemprop = 'price']/span[@class='offer_price_fraction']
),
',',
'.'
)
基于XSLT的ve rification:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select=
"translate(
concat(//span[@itemprop = 'price']/text()[normalize-space()],
//span[@itemprop = 'price']/span[@class='offer_price_fraction']
),
',',
'.'
)"/>
</xsl:template>
</xsl:stylesheet>
当该转化此XML文档上施加:
<span itemprop="price" class="offer_price">
<span class="currency">\u20ac</span>
16<span class="offer_price_fraction">,95</span>
</span>
XPath表达式求值和该评价的结果被复制到输出:
16.95
哇,真棒。谢谢!! – 2013-03-02 21:10:14
@MauriceKroon,不客气。 – 2013-03-02 21:11:25