[
Lists Home |
Date Index |
Thread Index
]
Jeni,
> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@jenitennison.com]
>
> Similarly, we already have a looping statement in XSLT --
> xsl:for-each. Most languages don't have a looping expression
> as well, but I recognise that it would be incredibly useful
> in XPath 2.0. That's why I said that there should be simple
> mapping operator, to handle the 80% of cases where you only
> need to loop over a single sequence. I've suggested something like:
>
> sequence-expression -> expression
>
> for example:
>
> (1, 2, 3) -> (. + 1)
>
> would give you (2, 3, 4).
You want this (in scheme):
(define (map func seq)
(if(null? seq)
nil
(cons (func (car seq)) (map func (cdr seq)))))
(I though XSLT had this. (Oops, it doesn't.))
> Yeah, innit great. But as far as I know, Lisp is a language
> in its own right.
<irked>
Yes it is great; you'd do well to take a look at it. It subsumes XML,
Xpath and XSLT, and in a saner industry, it should have been the
language you're using for your job; people have been using Lisp for the
kind of work XSLT+XPATH makes a pita for a long time. Still, them's the
breaks. On the other hand pretty much everything you want to do can be
found in CLisp functions, as Jeff is pointing out, so you can spec much
of your requirements from it.
</irked>
> I can see that, and that's why in many ways XQuery is the
> more elegant language -- it has a beautiful unified syntax
> because it's taken the step away from XML-based syntax.
>
> XSLT doesn't have that luxury. When we add statements to
> XPath, instead of getting a nice unified language, we get a
> mess where we have two ways of doing the same things, one in
> XPath and one in XSLT.
"It's better to have 100 functions operate on 1 data structure than to
have 10 functions operate on 10 data structures"- Alan Perlis.
Bill de hÓra
|