How to remove trailing zeros in XSLT

I have a node element like 1.0123000. I use XSLT for conversion. I need an output like 1.0123. Does anyone know how to do this in XSLT version 1.0?

Thanks in advance,
Jo

+3
source share
1 answer

It is easier than you think! Just use number()it and it will return the string 1.0123000as a number 1.0123in XSLT 1.0:

<xsl:value-of select="number('1.0123000')"/>

will return

1.0123

The function number()can be found in the XPath 1.0 specification .

+7
source

Source: https://habr.com/ru/post/1761044/


All Articles