RE: [xsl] Should variable resolution be done at compile-time or run-time?

Subject: RE: [xsl] Should variable resolution be done at compile-time or run-time?
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Fri, 17 Oct 2003 22:22:26 -0500
> The XSLT 1.0 spec says how the scope of variables is determined,
> but not when.  Is this a known gray area?  I just had a brief look,
> but XSLT 2.0:9.7 "Scope of Variables" doesn't specify this either.
> I know I would prefer this to be checked at compile-time, particularly
> with complex stylesheets with large numbers of rules and cases.

Are you asking when the stylesheet processor checks that variable references
are in scope of their referenced variables?

The scope of a variable is "determined" (i.e. knowable and unchangeable)
even before compile time. I'm not sure what it would mean to ask when
a stylesheet processor determines the scope of a variable.
Some might never do so, except when checking that referenced variables
are in scope.

As your experiment showed, some processors (Saxon) checked variable
references at compile time, others (Xalan, .NET) only at run time.

The spec leaves this question open, as it tends to do on questions
of efficiency. Stylesheet processors are free to optimize but aren't
forced to.

Lars


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


Current Thread