Re: [xsl] [xslt 2.0] Local functions

Subject: Re: [xsl] [xslt 2.0] Local functions
From: Justin Johansson <procode@xxxxxxxxxx>
Date: Fri, 20 Jul 2007 12:31:38 +0900
Dimitre,

>> I've tossed a poor man's lambda into my library which ends up calling
saxon:evaluate().
>
>Dimitre Novatchev:
>Using run-time evaluation is overkill here. A pre-processor would just
>do. Also, here the fact that XSLT is xml will come handy inboth
>analyzing the original stylesheet and in generating the result
>stylesheet -- this can all be done in XSLT.
>

Yes, you are dead right, it is an overkill; just that I hadn't completed the
preprocessor at the time and needed something quick and dirty.

The FXSL examples you provided are excellent and inspirational.

To give you a bit of background on my endeavour.  Like many others
I worked for many years with imperative languages.  My forte is/was
C++.  For years I wanted to get into functional programming but never
was there the opportunity in paid employment to do so.

I tried several times to learn LISP and read up on things like Haskell
and Scheme in my spare time but the penny never really dropped
for me.

My XSLT experience now dates about 5 years.  I just used it successfully
in a number of software engineering projects for generating high
quality documentation from a Telelogic DOORS requirements engineering
database.  This tool is widely used in the systems engineering
business.

http://www.telelogic.com/products/doors/doors/index.cfm

When I got heavily into a JavaScript project, the whole functional
programming thing dawned upon me after I read this article
The Little JavaScripter
http://www.crockford.com/javascript/little.html

Now when XSLT/XPath 2.0 came around the light got even brighter.
I saw the connection between Haskell and XSLT and embarked
upon writing XSLT generators with a Haskell-like model in mind.

I never knew about FXSL in the 4 or 5 years of doing XSLT 1.0.
Now I wish that I did; it would have saved heaps of time with
producing those requirements docs from DOORS.

Oh well, too late, I missed the FXSL boat and now too far down
the track with my own functional programming way of doing things
in XSLT 2.0.

No surprise, the tricks I do with templates to achieve higher-order
functions are very similar to what you have done in FXSL but 
somewhat cleaner (at least IMHO).

I do think though, that having XSLT 2.0 as a starting point for doing
FP in XSLT has been an edge for my endeavour.

Best regards



Justin Johansson
Now a Schema-Aware XSLT Evangelist

Current Thread