The input xml includes the following element:
输入xml包含以下元素:
<numberOfPayments>14.0</numberOfPayments>
I need to convert the number to integer, with following limitations:
我需要将数字转换为整数,但有以下限制:
- the XML is coming from an external source, I cant ask them to send me the integer
- it has to be an XPath, I can't use any other language
XML来自外部源,我不能让他们发给我整数
它必须是一个XPath,我不能使用任何其他语言
1 个解决方案
#1
5
You can use round()
. The xpath query would be:
你可以使用round()。 xpath查询将是:
round(/numberOfPayments/text())
or if you are only interested in the integer part without rounding you can use floor()
:
或者如果您只对整数部分感兴趣而不进行舍入,则可以使用floor():
floor(/numberOfPayments/text())
#1
5
You can use round()
. The xpath query would be:
你可以使用round()。 xpath查询将是:
round(/numberOfPayments/text())
or if you are only interested in the integer part without rounding you can use floor()
:
或者如果您只对整数部分感兴趣而不进行舍入,则可以使用floor():
floor(/numberOfPayments/text())