Re: XSLT 2.0: Parameterized imports?

Michael Kay wrote:

>> Would it be desirable (and feasible) to include a requirement
>> to permit passing global parameters to imported stylesheets?
>> 
>>    <xsl:import href="uri">
>>      <xsl:with-param name="param_name" select="somevalue"/>
>>    </xsl:import>
>> 
> Would this behave any differently from overriding the parameter in the
> importing stylesheet, i.e. writing
> 
> <xsl:import href="uri"/>
> <xsl:variable name="param_name" select="somevalue"/>

Thanks for the reply, Mike.

No, it would behave the same way. But re-declaring the global parameter 
in the importing stylesheet (the current solution) has one IMO egregious 
drawback: It doesn't force you to make explicit that you're overriding 
anything. Thus, you can quite unintentionally override a global 
parameter just by reusing "param_name" (or whatever) for your, uh, 
locally-declared global parameter.

I guess the question isn't really "would explicitly overriding imported 
parameters do anything that can't already be done by other means?" but 
rather "would explicitly-declared overrides of imported parameters 
improve usability and maintainability?" Yes, it *is* more verbose... but 
since when has that been a consideration? :)

================================================================
John E. Simpson
http://www.flixml.org
XML Q&A: www.xml.com

Received on Monday, 12 March 2001 11:11:42 UTC