RE: [xsl] format-number

Subject: RE: [xsl] format-number
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 3 May 2002 09:12:30 +0100
Try 00.00 as the format picture.

I suspect Xalan is saying "I can't output the number using the format
picture supplied, because the number is too big, therefore I will use a
fall-back representation that ignores the picture".

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> David Zuccaro
> Sent: 02 May 2002 23:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] format-number
>
>
> Thanks Stevenson,
>
> But I think it was a bad example on my part.
>
> When I use input xml of:
> <test>12</test>
>
> with:
>
> <?xml version='1.0' encoding='UTF-8' ?>
> <xsl:stylesheet version='1.0'
> xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
>    <xsl:template match="test">
>         <output>
>                 <xsl:value-of select="format-number(., '0.00')"/>
>         </output>
>     </xsl:template>
> </xsl:stylesheet>
>
> This is the output I am getting:
> <output>12</output>
>
> I want to get:
> <output>12.00</output>
>
> ie. I want all numbers to be output to 2 decimal places.
>
> Thanks
>
>
>
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Stevenson
> > Ngila
> > Sent: Thursday, 2 May 2002 17:28
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] format-number
> >
> >
> > If what you want to get is 12.00 I don't see why you want
> to format it.
> > Just say:
> > <?xml version='1.0' encoding='UTF-8' ?>
> > <xsl:stylesheet version='1.0'
> > xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> >     <xsl:template match="test">
> >         <output>
> >                 <xsl:value-of select="test"/>
> >         </output>
> >     </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> David Zuccaro
> > Sent: 02 May 2002 10:03
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] format-number
> >
> > Hi I'm having a problem with format number.
> >
> > This is my xml file:
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <test>12.00</test>
> >
> > This is my xsl code:
> > <?xml version='1.0' encoding='UTF-8' ?>
> > <xsl:stylesheet version='1.0'
> > xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> >     <xsl:template match="test">
> >         <output>
> >                 <xsl:value-of select="format-number(., '0.00')"/>
> >         </output>
> >     </xsl:template>
> > </xsl:stylesheet>
> >
> > This is the output I am getting:
> > <output>12</output>
> >
> > Shouldn't the output be:
> > <output>12.00</output>
> >
> > I'm using xalan.
> >
> > Thanks in advance.
> >
> >
> >  XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread