[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Running 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|