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

Re: Re: Designs for XSLT functions (Was: Re: RE: synta

Subject: Re: Re: Designs for XSLT functions (Was: Re: RE: syntax sugar for call-template)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 20 Feb 2001 11:46:59 +0000
xslt func
Hi Dimitre,

> I see... Then somePrefix:fn() What is different in exsl:function()
> vs. my:func() ??? They seem the same to me.

exsl:function() is a generic function for dynamically calling any
function at all by name.  my:func() is a particular extension function
that I want to call.  So strictly:

  my:func()

is equivalent to:

  exsl:function('my:func')

or to adopt your naming scheme:

  exsl:fn('my:func')

>> >> 2.b. Passing parameters by position vs. name
>> >
>> >
>> > fn(QName, p1="Name1 Value1",..., pN="NameN ValueN")
>> >
>> > This allows parameters to be passed by name (as above), 
>> 
>> This is a syntax that isn't allowed in XSLT 1.0.  That's not to say
>> that it wouldn't be a useful syntax to have, just that *we* cannot
>> make that change.
>
> OK,
> But the following is allowed, isn't it? 
>
> x:fn(QName, "Name1 Value1",..., "NameN ValueN")
>
> Variations of this allow for passing by name -- only, passing by
> position only, or a mixture of passing by name and passing by
> position.

Yes, and it would be a very interesting way of calling functions, in
particular because the expressions for getting their values could be
constructed as strings.  As Mike pointed out, if you have a static
method like:

  my:func(value1, value2)

then with a exsl:evaluate() function you could do:

  exsl:evaluate("my:func(value1, value2)")

to get the same effect.  That way you can construct anything on the
fly.

However, if we *only* have exsl:evaluate() then unless we allow
passing by name within the static method (which I guess is a
possibility), then we won't be able to allow access by name within the
dynamic method.

I personally think that a function for dynamic invocation of functions
would be more helpful.  Your method above is good because, as you say,
you can pass by position or by name (I'm not sure how you get the two
to mix - perhaps you can expand on that?).  This means that unlike the
method that Uche and I were talking about:

  exsl:call('my:func', 'Name1', Value1, 'Name2', Value2)

it could also be applied to existing XPath functions that do not have
a concept of 'named' arguments, only positional ones.  For example,
with your method you could do:

  x:fn('substring-before', '$string', '$char')

Whereas with the method Uche and I were talking about you'd be stuck.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.