Re: [xsl] Variable scope when using imported stylesheets

Subject: Re: [xsl] Variable scope when using imported stylesheets
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 24 Aug 2004 14:56:51 +0100
It's not totally clear what your requirements are but I think that you
are making the mistake (common for some reason) of thinking of variables
as holding Xpath expressions, they don't; they hold _values_ (node sets
in your case) so if you have a variable binding such as

<xsl:variable
   name="ImpVehData"
   select="FileRefEval/FileRefVehData"
/>


Then the value of $ImpVehData is whatever node set results in evaluating
that xpath __at the point of the declaration__. In common with most
programming languages, XSLT can not store an arbitrary expression in a
variable that you may re-evaluate, getting different results in different
contexts.

the smallest unit that you can re-evaluate in that way is a named
template. Calling a named template will cause the body of the template
to be evaluate in a context determined by the call.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread