XSLT: What's wrong with <xsl:value-of select="format-number(Amount, "##.##")" />

I have the following data:

<Amount>40.0</Amount>

I want to display it as:

40.00

Using something along the lines of:

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

I get "XML Parsing Error: not well-formed" in Firefox. I can find examples where it shows the value of an attribute in this way or for a fixed value, but not the contents of a tag.
tjrobinsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
Try:

<xsl:value-of select="format-number(Amount, '##.##')" />
0
tjrobinsonAuthor Commented:
That stops the error but I get an output of:

40

Probably something to do with the format parameter, I need to force the decimal places.
0
MogalManicCommented:
Try:

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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

tjrobinsonAuthor Commented:
Thanks that works well. I've split the points between you, but before you go is there any way of stopping it displaying if it's non a number (NaN)?
0
MogalManicCommented:
<xsl:choose>
  <xsl:when test='String(Number(Amount))="NaN"'>
          0.00
  </xsl:when>
  <xsl:otherwise>
     <xsl:value-of select="format-number(Amount, '#0.00')" />
  </xsl:otherwise>
</xsl:choose
0
tjrobinsonAuthor Commented:
Thanks, that looks just the job.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.