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

Re: Funky Summation

Subject: Re: Funky Summation
From: Paul Tchistopolskii <paul@xxxxxxx>
Date: Sat, 16 Sep 2000 00:23:34 -0700
xslt accumulator
----- Original Message ----- 
From: Alexey Gokhberg <alexei@xxxxxxxxxx>

> 
> AND A BIT MORE GENERAL QUESTION:
> 
> Is it possible to implement running counters in pure 100% XSLT, without
> using proprietary extensions?

There is no updateable variables in XSLT.

But there is general pattern for 'counter' :

template accumulator ( list ) {

    $first element = take first element of the list ( position() = 1 )
    $rest list = take the rest of the list ( position() > 1 )

    $total-of-rest  =  {
            if ( $rest ) { 
                 call accumulator(  $rest )
            } else {
                <!-- nothing. End of loop. -->
            }
    }

    <xsl:value-of select = " $first + $total-of-rest " />
}


Invokation: 

template( list-to-process )

>From my point of view, the answer is : 

"Yes, it is always possible to implement running counters 
in pure 100% XSLT"

Rgds.Paul.

PS. I wish I understand the question.



 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.