Reputation: 301
There is a node of the following content.
<item is_json_array="yes">
<name>Дополнительная услуга Количество IP-адресов - 1 Шт (Размещение сервера 1U #817)</name>
<amount>156.48</amount>
<taxrate>0</taxrate>
<taxamount>0.00</taxamount>
<notaxamount>156.48</notaxamount>
</item>
I need to tear out of the name
a substring containing only digits after the #
sign. 817
to the first non-numeric character or the end of the string. numeric characters can be any number of
Upvotes: 4
Views: 291
Reputation: 52888
Since you're using XSLT 1.0, you can use a combination of substring-after()
and translate()
to not only get the text after #
, but also strip any unwanted characters.
Example...
<xsl:template match="name">
<xsl:value-of select="translate(substring-after(.,'#'),translate(substring-after(.,'#'),'0123456789',''),'')"/>
</xsl:template>
A full working example can be seen here: http://xsltfiddle.liberty-development.net/gWcDMes/1
Upvotes: 3