xsl-list
[Top] [All Lists]

RE: Reference to variable cannot be resolved.

2003-02-13 12:46:46
From: Wendell Piez [mailto:wapiez(_at_)mulberrytech(_dot_)com]
Sent: Thursday, February 13, 2003 12:14 PM
Subject: Re: [xsl] 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(_dot_)martinez(_at_)trip(_dot_)com |
| 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