LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives

XML-L Archives

XML-L Archives


Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font


Join or Leave XML-L
Reply | Post New Message
Search Archives

Subject: Format-number xslt command problems
From: Becky Scott <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Sat, 12 Jan 2008 17:41:01 +0000

text/plain (24 lines)

Hello! I'm a new member of this listserv and am a relative newcomer to XML 
and XSLT, although I have written a few XSLT scripts.

I'm having a problem that I hope you can help me with.

I'm using the following command to add commas to a numeric field:

<xsl:template match="elementname">
<xsl:element name="elementname">
<xsl:value-of select="format-number(.,'#,###')"/></xsl:element>
Where "elementname" is the name of the element I am transforming. (I'm 
transforming a bunch of element values.)

Most of the time this works great -- I get the number in 1,234 format. But if 
the value of the element is 0 (zero), then this command causes a null field, so 
that the result is <elementname/>

I need to preserve those zeros! Any idea what I'm doing wrong and how to fix 

Thanks so much!

--Becky Scott 

Back to: Top of Message | Previous Page | Main XML-L Page



CataList Email List Search Powered by the LISTSERV Email List Manager