[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT repetition constructs
Am 07.03.2019 um 12:55 schrieb Michael Kay mike@xxxxxxxxxxxx:
A good simple use case for fold-left() is to accumulate a running total, i.e. turn (1,2,3,4) into (1,3,6,10). The example to simply compute the running total (e.g. map (1,2,3,4) to 10) is in the spec with B B fold-left((1 to 4), 0, function($a, $b) { $a + $b}) But to map the whole sequence (1,2,3,4) with fold-left to a new sequence of (1,3,6,10) I am already struggling to express that in a compact way, is fold-left( B (1 to 4), B (), B function ($a, $b) {B $a, if (empty($a)) then $b else $b + $a[last()] } ) a good way? Or can the third argument, the function be expressed in a more compact way?
|
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
|