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

RE: [xls] run-time variable name generation (e.g. "dou

Subject: RE: [xls] run-time variable name generation (e.g. "double de-referencing" {$($name)} )
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 11 May 2009 22:18:40 +0100
RE:  [xls] run-time variable name generation (e.g. "dou
> >  The dyn:evaluate function evaluates a string as an XPath 
> expression and returns the resulting value, which might be a 
> boolean, number, string, node set, result tree fragment or 
> external object. The sole argument is the string to be evaluated.
> > 
> > The string is always evaluated exactly as if it had been 
> literally included in place of the call to the dyn:evaluate 
> function. For example:
> > 
> > <xsl:value-of select="dyn:evaluate('my:extension(. * 
> $variable)')" />
> > 
> > Creates a text node with exactly the same value as:
> > 
> > <xsl:value-of select="my:extension(. * $variable)" />
> Of course you lose some portability, but...

Unfortunately that spec is horrible in terms of its impact on optimization.
Since the compiler has no idea what it will find in the run-time XPath
expression, it has vastly reduced scope for optimizing the static XSLT code.
For example, it can't expand variables inline: they have to be evaluated as
written, just in case the dynamic XPath expression uses them.
> And now I see that Saxon supports this too:
> http://saxon.sourceforge.net/saxon7.9/extensions.html#evaluate
> > The supplied string must contain an XPath expression. The 
> result of the function is the result of evaluating the XPath 
> expression. 

saxon:evaluate() does not provide access to variables declared in the
stylesheet, other than those explicitly passed as parameters to the call.

Michael Kay

Current Thread


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.
First Name
Last Name
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.