如何删除 XSL 模板中的小数点 [英] How to remove a decimal point in a XSL template

查看:27
本文介绍了如何删除 XSL 模板中的小数点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的值是 5050,而不是 xsl 模板中的 50.50 美元.这些值是从 subTotal[@formattedValue]" 中获取的.请帮助我在 xsl 中获取没有小数点的值

I want my value to be 5050, Instead of $50.50 in xsl template. The values are fetching from subTotal[@formattedValue]". please help me to get the value withou decimal point in xsl

推荐答案

以下是使用 translate()replace()

XSLT 1.0/2.0

<xsl:value-of select="translate(/subTotal/@formattedValue,'$.','')"/>

仅限 XSLT 2.0

<xsl:value-of select="replace(/subTotal/@formattedValue,'[^\d]','')"/>

其中之一适用于:

<subTotal formattedValue="$50.50"/>

产生:

5050

这篇关于如何删除 XSL 模板中的小数点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆