I have a template that can be loaded as standalone, or imported into other templates and then called using xsl:call-template. The template is declared using both the match and name attributes: <xsl:template name="main" match="/">

While using Xalan it was possible to declare the parameters inside the template, and then setParameter would pass them to the template, even though they really should be declared globally for this to work. But if they are declared globally, they are not available when the template is called after an import. Saxon enforces this. 

How can these two uses be reconciled?