[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Keeping a running total? (Redo)

Subject: Re: Keeping a running total? (Redo)
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 11 Jul 2006 12:36:46 -0700
running total
On 7/11/06, Steve <subsume@xxxxxxxxx> wrote:
I will cross that bridge when I get to it. I'm having a hard enough
time getting help for the first problem.

When I solve how to keep a running total, it will be easy to add
whatever is left over to the next quota.

Then here's the running-total part:

This xslt transformation:

<xsl:stylesheet version="2.0"

 <xsl:import href="../f/func-scanl.xsl"/>
 <xsl:import href="../f/func-Operators.xsl"/>

<xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/">
    <xsl:for-each select="f:scanl1(f:add(), /*/*/@capacity)">
     <xsl:value-of select="concat(., ', ')"/>

when applied against the provided source xml document:

<factory x="A" capacity = "3" />
<factory x="B" capacity= "5" />
 <factory x="C" capacity = "3" />
 <factory x="D" capacity = "2" />
 <factory x="E" capacity = "2" />

produces the wanted result (the list of running totals):

3, 8, 11, 13, 15,

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.