This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: patial sums
On Fri, Apr 12, 2002 at 09:00:06AM +0200, Vrajitoru wrote:
> I have an XML like this:
>
> <?xml version='1.0' ?>
> <?xml-stylesheet type='text/xsl' href='raport.xsl'?><data>
> <row Cod='212' Denumire='VINZARI CATRE ALTE UNITATI' Document='FACTURA'
> Numar='12358' Data='2000-10-19' Furnizor='32802' Comanda='X'
> Valoare='757900.0'/>
> ....
> </data>
>
> and in the following XSL I want to display partial sums on the attribute
> "Valoare" after each grouping. I am new in XML and I tried everything I knew
> but it doesn't work. It is possible? and if yes, how?
Boy, that is some dangerous-looking XSLT you've got there, sir ;-)
But the answer to your question is, yes. Here's a drastically simplified
example of one technique that will work:
<xsl:for-each select="row">
<xsl:value-of select="sum(@Valoare|preceding-sibling::*/@Valoare)"/>
</xsl:for-each>
In other words, each time a row is processed, output the sum of the
current row's Valoare attribute and the Valoare attributes of all
previous rows. I think that's what you need, isn't it?
Since I have no idea what you're trying to do with all those <xsl:key>s, I
will let you figure out how to integrate this into a template.
--
Matt Gushee
Englewood, Colorado, USA
mgushee@havenrock.com
http://www.havenrock.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list