This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: sum function used for values within a node


Michael wrote:

> I am returning values back from a recordset and populating 
> nodes with the
> values. I am struggling to sum those values once they have all been
> returned. 
> 
> for example:
> 
> I am returning each value from completed_setup with a for-each loop. 
> 
> 
> <xsl:for each Record/Reseller_ID>
> 
> <xsl:value-of select="./CLI/COMPLETED_SETUP"/>
> 
> </xsl:end each>
--------^^^^^^^^  surely not?

so they're Record/Reseller_ID/CLI/COMPLETED_SETUP's? It always helps to show
your xml.


> Later on what I want to do is to sum all values held within the
> <completed_setup>node and write out in a seperate cell. 
> The code im currently using is :
> 
> <xsl:value-of select="sum(../CLI/COMPLETED_SETUP)"/>
> 
> wihich is outide the above loop. 

does that mean, outside the above loop but in the same context as the loop?
If you're having to do <xsl:for-each select="Record/Reseller_ID"> then your
context is the parent of Record. If in that context you then ask for
"../CLI/COMPLETED_SETUP" then from what little glimpse of your xml you've
given us you're probably getting an empty node-set, unless the parent of the
the parent of Record also have CLI/COMPLETED_SETUP children...

How about summing "Record/Reseller_ID/CLI/COMPLETED_SETUP" instead? But this
is all mere conjecture, without knowing the contexts :)
> 
> Also is it possible to create seperate tables within the 
> stylesheet that
> appear at after a recordset has been displayed. I have 
> displayed  values
> back from a recordset howver I wish to have a final total 
> table at the end
> of the report which is written back. currently I have put 
> this as a seperate
> table aoutise the loop which processes invididual customers 
> however this
> total table appear at the bottom of each report page - I just 
> want it at the
> end of the report. 

what does your xml look like?

cheers,
Tom 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]