Re: [xsl] Function arguments (was regexps once)

Subject: Re: [xsl] Function arguments (was regexps once)
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Mon, 14 Jan 2002 16:15:15 -0500
Jeni,

[I wrote]
> > This suggests either a different keyword for functions that may
> > depend on the current context vs those that may not, or never
> > allowing functions to implicitly depend on the current context (and
> > thus function that wanted to do so would have to be written like
> > Jeni's second example, with
> >
> > <xsl:call-id select="my:resolve-uri($url, $node)" />
> >
> > ).
> >
> > For example, you could have xsl:function and
> > xsl:function-context-rel. Still, there could be trouble if a
> > function that was expected to be context-independent were to invoke
> > a context-dependent function as part of its definition. That would
> > have to be disallowed.
>
> I think that rather than disallowing calls to particular functions,
> you could make there be a difference between how the focus is set up
> for xsl:function-context-rel (where it's the same as the focus at the
> point when the function is called) and xsl:function (where it's
> something else, possibly the document node of the principal source
> document, as I discussed in an earlier mail to Joerg).
>
> An alternative to two elements, would be a "uses-context-from-call"
> flag on the xsl:function that is explicitly set to "false" if the
> function doesn't use anything about the context of the call.
>

Yes, I thought of using a flag, and I decided against it because you
wouldn't easily see it if you used included or imported function
definitions.  So it would be easy to assume an incorrect value for the flag
(or more likely, forget that there was a flag to pay attention to).  In
other words, a flag would be more error-prone than using a different
keyword.

> Assuming, of course, that some functions should be written with
> implicit information about the focus, which could be argued both ways.
>

Yes, definitely, assuming that...  which I'm not yet convinced would be such
a good idea...

Cheers,

Tom P


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


Current Thread