.NET Bug : global variables and xsl:import
I have two XSL files. transform.xsl and include.xsl.
transform.xsl
<?xmlversion="1.0"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
<xsl:importhref="include.xsl"/>
<xsl:variablename="MyVar">
<xsl:call-templatename="mytemplate">
<xsl:with-paramname="myname"select="'TEST'"/>
</xsl:call-template>
</xsl:variable>
<!--*************-->
<xsl:templatename="main">
<xsl:iftest="1 or 1">
<xsl:value-ofselect="1"/>
</xsl:if>
</xsl:template>
<xsl:templatematch="/"> include.xsl Now if I attempt to transform the transform.xsl file with MSXML 4.0 everything is fine. However if I transform this file with the MSXML .NET parser I get the following error: There must be a work around, or I need to set something in the .NET parser. Ideas anyone?
<xsl:call-templatename="main"/>
</xsl:template>
</xsl:stylesheet>
<?xmlversion="1.0"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
<xsl:variablename="Global1">GLOBAL 1</xsl:variable>
<!--*********-->
<xsl:templatename="mytemplate">
<xsl:paramname="myname"select="''"/>
<xsl:value-ofselect="$myname"/> --<xsl:value-ofselect="$Global1"/>
</xsl:template>
</xsl:stylesheet>
Unhandled Exception: System.Xml.XPath.XPathException: The variable or param 'Global1' is either not defined or it is out of scope.Now if I move my variable decalration "MyVar" inside the "main" template, everything is fine! No errors. Futhermore, if I just change my xsl:import to xsl:include, i no longer recieve any errors with both frameworks. However I can't just simply switch my xsl files to start using xsl:include instead of xsl:import.

