RE: [xsl] Continuously add to a parameter at each call

Subject: RE: [xsl] Continuously add to a parameter at each call
From: "Emil Soosaithasan" <emils@xxxxxxxxxxxxxxxx>
Date: Wed, 9 Nov 2005 15:07:25 -0500
To elaborate on my problem, For each of the Top Level Tasks - I have to
search through each Assignment - obtain the task that is related to the
assignment - check if the task obtained falls under the top-level task -
and if it does then get the cost.

For example,

I have 3 Top-Level tasks: "Hardware", "Software", "Analysis" and these
Top level tasks have low-level tasks under them.  My objective is to
obtain a total for each of these Top-Level Tasks.  The way I do this is
to go through each Top-Level Task and at the same time go through each
"Assignments", get the low-level tasks that correspond to the
Assignment, then check if that task is related to the Top-Level and get
the cost.  I can get all the tasks under a particular Top-Level task,
but once I get it - I am not too sure how to get the cost and have a
running total at the same time.

I really appreciate your quick response Michael

-----Original Message-----
From: Haarman, Michael [mailto:mhaarman@xxxxxxxxx]
Sent: Wednesday, November 09, 2005 2:37 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] Continuously add to a parameter at each call

> -----Original Message-----
> From: Emil Soosaithasan

Currently I am
> checking through all tasks to meet a certain condition and
> when there is
> a match I want to obtain the cost of the task and set that value to a
> parameter.  My desired end result should calculate the total
> cost of all
> tasks that satisfy the condition.


Why not use the sum() function?

The sum function returns the sum, for each node in the argument
node-set, of
the result of converting the string-values of the node to a number.

Then,

<xsl:value-of select="sum(/XPath/to/nodes[answeringToSomeCondition])"/>

with possibly a translate() inserted to remove symbols (euro, dollar,
etc.)

HTH,

Current Thread