[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT 2.0: Are arguments to functions evaluated ea

Subject: RE: XSLT 2.0: Are arguments to functions evaluated eagerly or lazily?
From: Justin Johansson <procode@xxxxxxxxxx>
Date: Wed, 18 Jul 2007 19:30:13 +0900
RE:  XSLT 2.0: Are arguments to functions evaluated  ea
Thanks for that Michael.

At 08:41 AM 18/07/2007 +0100, you wrote:
>> Supposing you have a function that is passed two arguments, 
>> say, a condition argument, test, and an argument,  value, 
>> that returns value if test is true and the empty sequence 
>> otherwise, is the value argument evaluated at the time of 
>> calling the function if the test argument is false?  
>
>The spec leaves this question open - the implementation can do either.
>Yes, Saxon does so (usually!). There are exceptions, for example if the

Yes, well, I would not expect anything less of Saxon :-)

>But for this particular case, I can't see that you're achieving any useful
>brevity or abstraction by writing select="f:cond(condition, value)" rather
>than select="if (condition) then value else ()".

For a moment just now I thought that I must have had a blond moment when
posing my question with that particular example but now I must be having a
blond moment even considering that I may have had a blond moment!

Of the face of it you are correct but the impetus of my question and the
example is due this functional programming kick that I'm on at the moment.

LISP has two such functions 'cond' and 'if' which do the same thing as my
two examples.  Now I'm not a LISP programmer and maybe there is no
if-then-else statement in LISP which therefore would make necessity for
said functions.  However I can see the usefulness of making such functions
available in a functional  programming style of library for XSLT as these
functions could be used as arguments to the Scheme-like functions foldl,
map, filter et. al.


Justin Johansson
Freelance XML / XSLT / XQuery Developer
Australia

procode(at)tpg(dot)com(dot)au

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.