RE: [xsl] The evaluate function

Subject: RE: [xsl] The evaluate function
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 3 Jan 2002 09:08:32 -0000
> A few questions on xsl "evaluate" functions
> First, I noticed the following in the 20 December 2001 XSLT
> Version 2.0
> working draft
> (
> <> ):
> 		Issue (evaluate-function): There is at present
> no consensus
> within the working group that such a function should be
> provided, as it has
> significant implications on the run-time architecture of the
> processor, as
> well as the ability to do static optimization.
> Are there leanings in either direction, or is this particular issue in
> deadlock?

I'm not going to share with you what the opinions of individual XSL WG
members are. But I think a reasonable summary of the situation is that the
group decided to exclude this functionality from the current draft because
they felt that more discussion was needed.

Some of the discussion needed is over details (for example, should the
expression be allowed to contain variable references, or calls to extension
functions? If the expression is read from a source document, how should
namespace prefixes be resolved?). Some relates to other issues concerned
with static typing: we are generally trying to move towards having as much
type information as possible available statically, and a crude evaluate()
function takes us in the opposite direction. Some is a concern about
principles: how do we cater for implementors who want to compile stylesheets
into compact executable code and ship that code for execution on handheld
> It seems that many questions on this list involve solutions
> that require use
> of an evaluate function. So the need is clearly there.
It would be useful if you would make that point to the xsl-editors list,
ideally with a summary of the common use cases.
> Other questions:
> Both Saxon and Xalan support evaluate functions. Are there
> widely used XSL
> processors that do not provide such a capability? Does MSXML
> provide an equivalent? How is it invoked?

I'm pretty sure the capability is absent from quite a few processors, and is
differently implemented in those that do provide it. In MSXML you have to
escape into JavaScript, passing the expression as a parameter; you can then
use selectNodes() or other methods from your JavaScript, and pass the result
back to the stylesheet.
> Do all of the existing implementations perform the
> evaluations uniformly?
> Could I expect Xalan and Saxon to evaluate the same XPath
> expression and get
> a different result (barring, of course, any bugs).
I think you'll probably find they are all a bit under-specified! I suspect
there are minor differences relating to the accessibility of variables, the
ability to call extension functions, aspects of the context such as base
URI, ability to resolve namespace prefixes, and so on.

Mike Kay

 XSL-List info and archive:

Current Thread