Subject: [xsl] Problem accumulating values. From: Patricia Santana Cruz <patriciasc@xxxxxxxxxxxxx> Date: Thu, 03 Mar 2011 12:27:14 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT2 test for null, Andrew Welch | Thread | Re: [xsl] Problem accumulating valu, Andrew Welch |
Re: [xsl] HST's answers Re: [xsl] E, Michael Kay | Date | Re: [xsl] Problem accumulating valu, Andrew Welch |
Month |