|
Subject:
|
adding of element and assigning to one element
|
|
Posted By:
|
sushovandatta
|
Post Date:
|
11/12/2004 6:07:13 PM
|
Hi
I am having this problem.I have tried to make the xml simple. Input XML <test> <qty> <one>2</one> </qty> <qty> <one>3</one> </qty> <qty> <one>4</one> </qty> <qty> <one>5</one> </qty> </test> and out put xml
<result> <add></add> </result>
the value of the "add" should be the addition of element value "one"
Like <add>2+3+4+5</add>
Plz let me now if any one can help me out.
Datta
|
|
Reply By:
|
jkmyoung
|
Reply Date:
|
11/12/2004 7:44:51 PM
|
did you actually want the string '2+3+4+5' or did you want 14?
if 14, it'd be <add><xsl:value-of "sum(test/qty/one)"/></add> (assuming you're starting from the test node)
if you want the string, try a for-each loop. http://www.w3schools.com/xsl/default.asp
|
|
Reply By:
|
sushovandatta
|
Reply Date:
|
11/16/2004 6:04:28 PM
|
thanks a lot jkm
|