Re: (dsssl) simple loop question

Subject: Re: (dsssl) simple loop question
From: Ian Zimmerman <itz@xxxxxxxxxxxxx>
Date: 10 Apr 2003 09:12:57 -0700
Mirek> Hi, I have simple problem with processing node list in loop. I
Mirek> do not know where to put increment condition (finally I comment
Mirek> it out and jade is processing only the first element as
Mirek> expected).

DSSSL is a functional language, so use recursion instead of iteration,
or even better, use higher order functions.  I haven't checked your
code for anything else, but this should convey the idea:

(define wrap-with-mi (lambda (#!optional (nl (children (current-node))))
        (map (lambda (n) (if (equal? 'data-char (node-property 'class-name n))
                             (make element gi: "mi"
                             (literal (string (node-property 'char n))))))
                         (process-node-list cn)

"This is the patent age of new inventions
For killing bodies, and for saving souls,
All propagated with the best intentions." 
George Gordon, lord Byron

 DSSSList info and archive:

Current Thread