Re: [xsl] Variable Scope

Subject: Re: [xsl] Variable Scope
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Wed, 11 May 2005 12:05:29 -0700
I could post actual code, it's a lot though.

On 5/11/05, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> Perhaps you could put together a simple 3-module example that illustrates
> the problem.
>
> From what you've shown us, it looks as if the variable should be in scope.
> Once we've seen and checked your code, the next question is which processor
> you are using.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Karl Stubsjoen [mailto:kstubs@xxxxxxxxx]
> > Sent: 11 May 2005 17:38
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] Variable Scope
> >
> > Hello,
> >
> > So far I have not ran into any troubles with variable scope, and I am
> > refering to globabl variable scope - variables defined within my base
> > template.  I am having trouble now with a MAX_DATE variable I have
> > defined.  So, I am wondering about execution plan and where/when
> > variables are available.  Given the following inclusiong/import plan I
> > will attempt to describe where it appears that MAX_DATE(s) scope is
> > out-of-scope.
> >
> > base_template.xsl
> >   MAX_DATE is defined (see definition below)
> >
> > working_template_a.xsl
> >   {imports} base_template
> >   {includes} working_template_b.xsl
> >   {includes} working_template_c.xsl
> >   {includes} working_template_d.xsl
> >   {includes} ... additional working templates ..
> >
> > MAX_DATE inside of any template definition inside of any included file
> > above is fine.  MAX_DATE used as part of a variable definition at the
> > top (outside a template rule) of any of these include files throws the
> > error:  "The variable or param MAX_DATE is either not defined or it is
> > out of scope".
> >
> > Any ideas on this?
> >
> >
> > Note:  CreateNewDate template is defined in base_template.xsl
> > <xsl:variable name="MAX_DATE">
> > <xsl:call-template name="CreateNewDate">
> >   <xsl:with-param name="start_year" select="$FISCAL_YEAR" />
> >   <xsl:with-param name="start_month">06</xsl:with-param>
> >   <xsl:with-param name="start_day">30</xsl:with-param>
> > </xsl:call-template>
> > </xsl:variable>

Current Thread