この単一のXPath式を使用します。
translate(
concat(//span[@itemprop = 'price']/text()[normalize-space()],
//span[@itemprop = 'price']/span[@class='offer_price_fraction']
),
',',
'.'
)
XSLTベースの検証:
<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