This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Global variable in included stylesheet


> I have xml file (global.xml) and two xsl files (1.xsl, 2.xsl).
> File global.xml is transformed with the stylesheet 1.xsl.
> File 2.xsl is included in 1.xsl.
>
> File 1.xsl
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
> <xsl:include href="2.xsl"/>
>
> <xsl:variable name="DefaultLanguageID"/>
>
> 	<xsl:template match="global-settings">
> 		<xsl:variable name="DefaultLanguageID"
> select="parameter[@name='DefaultLanguageID']/@value"/>
>

You have two separate variables here with the same name: a global variable
which is accessible anywhere in the stylesheet (including in other modules),
whose value is the empty string "", and a local variable which is accessible
only within one template rule. There is absolutely no relationship between
these two variables apart from the fact that they share the same name.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]