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

I have the following data:


I want to display it as:


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.
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:

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


Probably something to do with the format parameter, I need to force the decimal places.

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


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)?
  <xsl:when test='String(Number(Amount))="NaN"'>
     <xsl:value-of select="format-number(Amount, '#0.00')" />
tjrobinsonAuthor Commented:
Thanks, that looks just the job.
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

From novice to tech pro — start learning today.