Re: [xsl] Summing grouped elements

Subject: Re: [xsl] Summing grouped elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 7 Feb 2005 13:38:01 GMT
you haven't shown enough of your stylesheet or any of your input so it's
hard to really make any suggestions, but...


   <xsl:for-each select="$referencias">

what's the definition of $referencias, and what to teh elements in that
node set look like?

     <xsl:if test="generate-id(.)=generate-id($referencias[isbn=$isbn])">

This is just true for the first element with each isbn.

         <xsl:for-each select="$referencias[isbn=$isbn]">
this selects all the elements with that isbn (probably you ought to be
using a key to speed this up)

     <xsl:sort select="../../../@name" order="ascending" />
     <xsl:sort select="../../descricao" order="ascending" />

I assume they work, without seeing your input format it's impossible to
say.


  Total: <xsl:value-of select="sum(../../vagas)" />     <--Here is my problem
  it doesn't display the total, only appear the value to a single element -->


In that case it is most likely ../../vagas only selects one element, but
we can't say as we have not seen any input.

Make a small (3 or 4  references) input file and a small complete
stylesheet and post saying what result you get and what result you want.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread