Jump to content

xslt 2.0 remove trailing zeroes from decimal places


LucifersSon
 Share

Recommended Posts

I have an existing xslt 2.0 and I want to add an entry, that remove unnecessary trailing zeroes from decimal places.

<value>50<value> -> <value>50<value>
<value>50.0<value> -> <value>50<value>
<value>50.00<value> -> <value>50<value>
<value>50.01<value> -> <value>50.01<value>
<value>50.10<value> -> <value>50.1<value>
<value>50.101<value> -> <value>50.101<value>
<value>50.0010<value> -> <value>50.001<value>

The xml can come in in different substructures and in different tags, just looking for the same tag will not do it.

value1>50.0010<value1>
<substruktur>
   <value2>50.1010<value2>
</substruktur>
->
<value1>50.001<value1>
<substruktur>
   <value2>50.101<value2>
</substruktur>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...