How to Round of number data returned by XSLT. - XML SOAP

This is a discussion on How to Round of number data returned by XSLT. - XML SOAP ; Hi, I have a XSLT file to mapped to commissions field. it's multiplied with say 0.01 (as shown). The xslt returns the number with 20 decimal digits. What do I add to the xsl to round of the result to ...

+ Reply to Thread
Results 1 to 2 of 2

How to Round of number data returned by XSLT.

  1. Default How to Round of number data returned by XSLT.

    Hi,

    I have a XSLT file to mapped to commissions field. it's multiplied with say
    0.01 (as shown).
    The xslt returns the number with 20 decimal digits. What do I add to the xsl
    to round of the result to 4 decimal places.
    Commision is a double type field in c#.

    <xsl:for-each select="Commission">
    <Commissions>
    <xsl:value-of select=".*0.01"/>
    </Commissions>
    </xsl:for-each>

    Please excuse me for my very low knowledge for xslt.

    please also copy the reply to Sandeep.Singh@mgl.com. This is to help my
    colleague, who wont be able to check it in this group.

    Regards,
    Sugandh




  2. Default Re: How to Round of number data returned by XSLT.

    Sugandh Jain wrote:

    > I have a XSLT file to mapped to commissions field. it's multiplied with say
    > 0.01 (as shown).
    > The xslt returns the number with 20 decimal digits. What do I add to the xsl
    > to round of the result to 4 decimal places.
    > Commision is a double type field in c#.
    >
    > <xsl:for-each select="Commission">
    > <Commissions>
    > <xsl:value-of select=".*0.01"/>
    > </Commissions>
    > </xsl:for-each>


    Use format-number <http://www.w3.org/TR/xslt#format-number>:
    <xsl:value-of select="format-number(. * 0.01, '0.0000')"/>


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

+ Reply to Thread

Similar Threads

  1. round number to the nearest...
    By Application Development in forum PHP
    Replies: 6
    Last Post: 08-28-2007, 05:54 PM
  2. Replies: 0
    Last Post: 06-21-2007, 07:38 AM
  3. Error number returned different from IDE to EXE
    By Application Development in forum basic.visual
    Replies: 4
    Last Post: 05-08-2007, 06:08 AM
  4. AWK round up to whole number question
    By Application Development in forum awk
    Replies: 3
    Last Post: 03-03-2007, 06:07 AM
  5. Round number depending on error
    By Application Development in forum awk
    Replies: 3
    Last Post: 04-26-2006, 05:02 AM