How to add two value in xslt

Discussion in 'ASP .Net' started by ad, Feb 26, 2006.

  1. ad

    ad Guest

    I have a xslt file, there are tree columns in a table,
    There is Value1 in column 1 and Value2 in column2.
    The type of Value1 and Value2 are number.
    I want to add Value1 and Value2 together and display it in column3
    I use <xsl:value-of select="Value1"/>+ <xsl:value-of
    select="Value2"/>
    in the below example, but it display as string concatenate , not number add.

    How can I do a number adding in xslt?


    ----------------------------------------------------------------------------------------------------------------------------

    <table width="100%" border="1">
    <tbody>
    <xsl:for-each select="DocumentElement/SightMatrix">
    <tr>
    <td width="24%">
    <xsl:value-of select="Value1"/>
    </td>
    <td width="24%">
    <xsl:value-of select="Value2"/>
    </td>
    <td width="24%">
    <xsl:value-of select="Value1"/>+
    <xsl:value-of select="Value2"/>
    </td>
    </tr>
    </xsl:for-each>
    </tbody>
    </table>
     
    ad, Feb 26, 2006
    #1
    1. Advertising

  2. ad

    Teemu Keiski Guest

    Have you tried

    <xsl:value-of select="Value1 + Value2"/>

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "ad" <> wrote in message
    news:...
    >I have a xslt file, there are tree columns in a table,
    > There is Value1 in column 1 and Value2 in column2.
    > The type of Value1 and Value2 are number.
    > I want to add Value1 and Value2 together and display it in column3
    > I use <xsl:value-of select="Value1"/>+ <xsl:value-of
    > select="Value2"/>
    > in the below example, but it display as string concatenate , not number
    > add.
    >
    > How can I do a number adding in xslt?
    >
    >
    > ----------------------------------------------------------------------------------------------------------------------------
    >
    > <table width="100%" border="1">
    > <tbody>
    > <xsl:for-each select="DocumentElement/SightMatrix">
    > <tr>
    > <td width="24%">
    > <xsl:value-of select="Value1"/>
    > </td>
    > <td width="24%">
    > <xsl:value-of select="Value2"/>
    > </td>
    > <td width="24%">
    > <xsl:value-of select="Value1"/>+
    > <xsl:value-of select="Value2"/>
    > </td>
    > </tr>
    > </xsl:for-each>
    > </tbody>
    > </table>
    >
     
    Teemu Keiski, Feb 26, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    689
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,691
    Dimitre Novatchev
    Sep 25, 2003
  3. GenxLogic
    Replies:
    3
    Views:
    1,289
    andrewmcdonagh
    Dec 6, 2006
  4. =?UTF-8?b?5byg6Z+h5q2m?=
    Replies:
    3
    Views:
    711
    DeepthiShri
    Oct 23, 2006
  5. jag
    Replies:
    0
    Views:
    590
Loading...

Share This Page