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

RE: Subject: Expression handed to saxon:evaluate can't

Subject: RE: Subject: Expression handed to saxon:evaluate can't access variables
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 25 Sep 2009 09:08:19 +0100
RE:  Subject: Expression handed to saxon:evaluate can't
saxon:evaluate allows you to use variables $p1...$p9 and to bind these in
the call:

normalize-space(concat($p1/Caption,' ',$p2/Caption))

saxon:evaluate(Caption, $parentnode, $tablenode)

The reason that the dynamic expression can't evaluate XSLT variables
directly is that the Saxon optimizer potentially looks at all the places
where a variable is used and makes decisions accordingly: for example, if
there is only one reference then the variable may be "inlined". This kind of
optimization isn't possible unless all references to the variable are
statically known.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

 

> -----Original Message-----
> From: rowan@xxxxxxxxxxxxxxxxxxxxx 
> [mailto:rowan@xxxxxxxxxxxxxxxxxxxxx] 
> Sent: 24 September 2009 11:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Subject: Expression handed to saxon:evaluate 
> can't access variables
> 
> I'm trying to design a transform that needs to evaluate an 
> expression taken from the XML input file. I'm trying to use 
> the saxon:evaluate function to do this, as follows:
> <xsl:value-of select="saxon:evaluate(Caption)"/>
> 
> The problem seems to be that my expression (which is in the 
> Caption element of my source file):
> normalize-space(concat($parentnode/Caption,' ',$tablenode/Caption))
> 
> contains some references to variables. When I try to run 
> this, it reports "Static error in XPath expression supplied 
> to saxon:evaluate: Undeclared variable in XPath expression: 
> $parentnode".
> 
> When I put the expression directly into my XSL file like this:
> <xsl:value-of select="normalize-space(concat($parentnode/Caption,'
> ',$tablenode/Caption))"/>
> 
> it works.
> 
> How can I get this sort of expression supplied from the 
> source file to evaluate properly?
> 
> Many thanks - Rowan
> 
> 
> 
> --------------------------------------------------------------------
> mail2web.com - MicrosoftR Exchange solutions from a leading 
> provider - http://link.mail2web.com/Business/Exchange

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.