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>