This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: implement for loop with XSLT
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] implement for loop with XSLT
- From: Goetz Bock <bock at blacknet dot de>
- Date: Sun, 18 Mar 2001 21:32:53 +0100
- References: <200103180730.CAA13418@biglist.com> <20010318201429.50138.qmail@web12606.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
On Sun, Mar 18 '01 at 12:14, Dan Diebolt wrote:
> I came up with the enclosed code to grab the value of an <n> element
> and generate a list of integers and their squares between 1 and n:
> [ ... ]
> If I am stuck with this recursive solution, is there a way
Well, recursion is the only way using a functional programming language,
and there is nothing bad about it.
Somewhere on the web, there is an XSL-T preprocessor that allows you
write for, while and until loops, but IMNOHP you should try functional
programming, it realy rocks.
> to write a generic "for" template but pass in a "body" that
> needs to be evalutate? For example pass a string "$i*$i*$i"
> to evaluate cubes).
for this to work , you'd need an evaluate statement, some XSL-T
processors offer it and there are attemps to extend XSL-T to support it.
(I'm not sure wether this is a good thing or not)
Cu,
Goetz.
PGP signature