Subject: RE: Reference to variable cannot be resolved.
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Thu, 13 Feb 2003 12:46:46 -0700
|
> From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
> Sent: Thursday, February 13, 2003 12:14 PM
> Subject: Re: Reference to variable cannot be resolved.
>
> Imrran,
>
> Bind the lookup node set to its variable globally, i.e. outside any
> templates. Then it will be in scope for any template.
>
> It also means that the expensive document('lookup.xml') call
> will happen
> once, not every time a given template is hit. Not all
> processors optimize this.
Oops, good point. My solution would be quite expensive in that context.
Perhaps if the variable was bound in the root template (i.e. match="/"),
then one document() call would suffice provided you passed the lookup node
as a param when needed.
It could just be a matter of style, but I try to avoid using global
variables unless absolutely necessary. As a side question, what effect is
there in terms of performance or efficiency in having a lot of global
variables declared? The few programming classes I've taken (using
procedural languages) have taught that a lot of global variables are a Bad
Thing, but maybe that axiom doesn't necessarily apply to XSLT.
b.
| brian martinez brian.martinez@xxxxxxxx |
| senior gui programmer 303.708.7248 |
| trip network, inc. fax 303.790.9350 |
| 6436 s. racine cir. englewood, co 80111 |
| http://www.cheaptickets.com/ http://www.trip.com/ |
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|