[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem accumulating values.

Subject: Problem accumulating values.
From: Patricia Santana Cruz <patriciasc@xxxxxxxxxxxxx>
Date: Thu, 03 Mar 2011 12:27:14 +0100
 Problem accumulating values.
Hello,

I am having problems accumulating a value that I need in my program. I
have really tried every tip or recommendation I read in several forums
from people who had a "similar" problem and asked in the #xml channel
too, but unfortunately nobody could help.

I think that examples are better for explaining problems, so I go
straight with it. My .XML file has the following structure (small real
example: http://pastebin.com/SD6fcCtU):

<year>
  <week>
    <day>
      <task>
        <details></details>
      </task>
      <task>
        <details></details>
      </task>
    </day>
    <day>
      <task>
        <details></details>
      </task>
    </day>
  </week>
  <week>
    <day>
      <task>
        <details></details>
      </task>
      <task>
        <details></details>
      </task>
    </day>
  </week>
</year>

Each of these nodes have different attributes. The ones that matter are
those regarding to 'task':
 -end: string with dayTime value.
 -start: string with dayTime value.
 -name: string.
 -client: string.

In my .XSLT file, I am calculating the duration of each task doing:
<xsl:variable name="duration" select="xs:dateTime(@end) -
xs:dateTime(@start)"/>

The _problem_ is, that I need to calculate at the end of each week, the
total duration time of all the tasks for that week (week = duration time
of task 1 + duration time of task 2 + duration time of task 3...). I
have tried using the sum() function in different ways but did not
worked. I also tried creating a new tag inside my 'task' node, but it
just does not work, sum() keeps on appending the values instead of
summing them.

This is how my .XSLT file looks like: http://pastebin.com/jLV2EHFa

and this is the result generated file: http://pastebin.com/dDpJVqLL

As you see, the results are appended and not summed, which is what I
need.

Could you please help me with this issue?. I really do not know what
else I can do.

Thank you in advance,
Patricia.

-- 
patriciasc@xxxxxxxxxxxxx
http://psconboard.blogspot.com/
www.openismus.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.