xsl-list
[Top] [All Lists]

RE: [xsl] Round function in XSL 1.0

2010-04-07 04:09:26
Hi, Anil

To achieve the below your request, you can use java script in XSLT. 

Just have a look the below link for java script
http://www.mediacollege.com/internet/javascript/number/round.html 


Regards,
Ram Kumar


-----Original Message-----
From: Vladimir Nesterovsky [mailto:vladimir(_at_)nesterovsky-bros(_dot_)com] 
Sent: Wednesday, April 07, 2010 1:24 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Round function in XSL 1.0

Try with the below:

<xsl:variable name="amount_val" select="'8.42500'"></xsl:variable>
<xsl:value-of select="round(100 * number($amount_val)) div 100"/>

That's very wrong!
As "The round function returns the number that is closest to the argument 
and that is an integer. If there are two such numbers, then the one that is 
closest to positive infinity is returned."

round(842.500) => 843
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com/



-----Original Message-----
From: Anil Kumar Veeramalli 
[mailto:anil(_dot_)v(_at_)frescoinformatics(_dot_)com] 
Sent: Wednesday, April 07, 2010 12:19 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Round function in XSL 1.0

Hi
 I am using  XSL 1.0 version. I am looking for Rounding function similar

to SQL.

  <xsl:variable name="amount_val" select='8.42500'></xsl:variable>

I have a variable with  the value of 8.42500. Its a string. I want to 
round this number to 8.43. How can I do this in XSL1.0.

Please suggest me on this.

Thanks,
Anil


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~-- 




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>