XSL: format-number does not add leading zero

Posted on 2004-10-21
Last Modified: 2008-01-09
Format-number does not add leading zeros for numbers 0<n<1

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

someNode       Output
123.1230001     123.12
0.900                 .9

That last example should be "0.9"    

Please advise


Question by:jasww
    LVL 4

    Accepted Solution

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

    Author Comment

    Will that screw up other numbers?

    Such as 123.123, will it output "1230.12" by mistake?

    LVL 4

    Expert Comment

    no, but i'm not really sure. i haven't touched xsl for a while, but give it a try

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Prepare to Pass the CompTIA A+ 900 Series Exam

    CompTIA aims to adapt its A+ Certification to reflect the most current knowledge and skills needed by today's IT professionals--and this year's 2016 exam is harder than ever. This certification is one of the most highly-respected and sought after in IT.

    The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
    Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    857 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now