Hara
Hara

Reputation: 1502

showing -0.45 in html using xsl

I am trying to format the output of xml and xsl value with one zero added only if the value is less than one and more than -1.

I want to show -0.45 for -ve values, and for +ve values 0.45, only if the value is in between -1 and +1. if not in that range then html itself showing properly. like 1.45 or -1.45

But what ever I use in xsl and xml or any combination, i could see output in final html page as -.45 for -ve and .45 for +ve.

I tried the below method also. no use...

<xsl:value-of select="format-number(-0.45, '#.00')"/>

This looks simple, but could not get proper solution. I am not good in xml as of now. Please share if any suggestions?

Upvotes: 0

Views: 58

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167641

It sounds as if you want format-number(-0.45, '0.00').

Upvotes: 1

Related Questions