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

Re: Running totals

Subject: Re: Running totals
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Tue, 28 Dec 1999 11:44:28 -0500
xsl totals
The likely way to do this, then, is to move whatever processing
you are doing into a tail-recursive function, and pass the running
total in each time as a parameter:

  <xsl:template name="do-whatever">
  <xsl:param name="running-total" select="0"/>
  [do-whatever-processing]
  <xsl:if test="[some-do-i-go-again-test]">
    <xsl:call-template name="do-whatever">
    <xsl:with-param name="running-total"
select="$running-total+@value"/>
    </xsl:call-template>
  </xsl:if>
  </xsl:template>

 Steve

Jon Smirl wrote:
> 
> Computing the sum of the preceding elements on each line for 2000 rows takes
> 2000 * (2000/2) = 2 million operations. If I can figure out a way to carry
> the total along I can do it in 2,000 operations.
> 
> I can always write an extension function to do this but I was trying to do
> it with pure XSL.
> 
> Jon Smirl
> jonsmirl@xxxxxxxxxxxx
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
----------------------------------------------------------------------
Steve Tinney                                        Babylonian Section
                                 *   University of Pennsylvania Museum
stinney@xxxxxxxxxxxxx                          Phila, PA. 215-898-4047


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.