Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2004, 07:07 PM
Registered User
 
Join Date: Nov 2004
Location: Bangalore, Karnataka, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default adding of element and assigning to one element

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

 
Old November 12th, 2004, 08:44 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to jkmyoung
Default

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

 
Old November 16th, 2004, 07:04 PM
Registered User
 
Join Date: Nov 2004
Location: Bangalore, Karnataka, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot jkm






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
Assigning node value to a href element!!!!!!!!! rakesh XSLT 4 July 25th, 2008 03:17 PM
Adding a new Element monuindia2002 XML 2 March 13th, 2006 11:59 PM
assigning a css style sheet from an element miguel XSLT 7 August 8th, 2004 01:21 PM
Adding an element to a binded DropDownlist mahulda ASP.NET 1.0 and 1.1 Basics 3 March 10th, 2004 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.