xsl-list
[Top] [All Lists]

RE: Saxon versus Xalan implementations of evaluate() extension function?

2005-07-07 13:02:07
Saxon 8.x does too much optimization to be able to guarantee that variables
declared in the stylesheet actually exist as such at run-time (for example,
variables that are never referenced are ignored completely). So I decided to
disallow direct access to variables in saxon:evaluate(). Instead, you can
pass parameters $p1..p9 to the query, e.g.

saxon:evaluate("$p1 + 3", $x)

returns 5 if $x is initialized to 2.

Micahel Kay
http://www.saxonica.com/

-----Original Message-----
From: Andrzej Taramina [mailto:andrzej(_at_)chaeron(_dot_)com] 
Sent: 07 July 2005 16:27
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: mike(_at_)saxonica(_dot_)com
Subject: Re: Saxon versus Xalan implementations of evaluate() 
extension function?

Adrian suggests:

I think just doing all evaluations in a variable
beforehand should give you a bit more safety to work
in saxon/xalan/both. I was using xalan with the dyn
EXSLT extension and saxon and it seemed to work...
Although when I wanted to make it processor
independant to check beforehand what evaluate to use
like so... <xsl:apply-templates
use-when="function-available(dyn:evaluate)"
select="dyn:evaluate($evalThis)"/>, xalan 1.0
processor seemed to have a problem with the use-when
if this is an issue to work in both. I wasnt sure of a
workaround).

Is dyn:evaluate() availabe in Saxon 8.4? How about Saxon 6.5.4?

but back to the problem, does this work?...
<xsl:variable name="evalThis" select="concat(
'$data/', @xpathValue )" />
... saxon:evaluate( $evalThis )

at worst try this...
<xsl:variable name="evalThis" select="concat( $data,
'/', @xpathValue )" />
... saxon:evaluate( $evalThis )

Won't work, since many times the variable $data is a node 
set.  Xalan handles that fine.
saxon:evaluate won't bind to the variable.

I tried reverting to Saxon 6.5.4 but then kept getting the 
following exception:

javax.xml.transform.TransformerException: Error in expression 
: Unexpected token EOF in
expression

Anyone know what causes this exception and why Saxon 6.5.4 
would throw this when Saxon 8.4
and Xalan don't, on the same stylesheet source?

Thanks!

....Andrzej

Chaeron Corporation
http://www.chaeron.com




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--