473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to add two value in xslt

ad
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>
Feb 26 '06 #1
1 1100
Have you tried

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

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

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:ea*************@TK2MSFTNGP10.phx.gbl...
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>

Feb 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: inquirydog | last post by:
Hi- One frusterating thing for me with xsl is that I don't know how to make xslt throw some sort of exception when a value-of path does not exist. For instance, suppose I have the following...
1
by: mikea_59 | last post by:
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value>
5
by: Ian | last post by:
(Please excuse the rookie question) Why don't I get the value of "windows" in my file? My xml file is located in http://www.otima.ca/XML/auto.xml and the xslt file is...
1
by: ms_chika | last post by:
Please help! I just want to know how can i pass the return value of a javascript function to a xsl variable. I have an xsl file and from that file i will call a javascript function then the...
1
by: David C. allen | last post by:
I have created a simple Client-side SOAP Extension for a webclass that I have. When I apply the extension attribute to the the calling function in the proxy class I get an error 'Value cannot be...
2
by: Rick | last post by:
I have an XML document that is generated from Infopath, I need to change the value of a namespace that is defined in a node in the form: <xsf:xDocumentClass "xmlns:my=valuehere">. when i navigate...
4
by: ina | last post by:
Hello all, I am newbie in xml and have a problem with this parse. I have this xml.file <Style> <Strategy>
14
by: gooooglegroups | last post by:
I want to transform the following xml file ------------------------------------------------------------------------ <?xml version="1.0" encoding="ISO-8859-1"?> <a> <b attrib="if 3 2"> </b> ...
0
by: shapper | last post by:
Hello, I am transforming a XML file into another XML file using a XSLT. Everything is working fine! I have only one problem: I want one of the values in my XSLT file to be taken from a Key...
11
by: Ebenezer | last post by:
Let's suppose I have some nodes in an XML file, with an URL attribute: <node url="mypage.php?name1=value1&foo=bar&foo2=bar2&name2=value0" /> <node...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.