Passing variables to xsl:include xsl:imports, and xsl:call-template (or the static nature of XSL)

Subject: Passing variables to xsl:include xsl:imports, and xsl:call-template (or the static nature of XSL)
From: "Maxime Levesque" <maximel@xxxxxxxxxxxxxx>
Date: Thu, 15 Jul 1999 14:04:36 -0700

<! -- I wish I could do the following : -->

  <xsl:variable
name='setOfTemplates'>"http://myXSLTSheet1.xsl";</xsl:variable>
...
  <xsl:include href="{$setOfTemplates}"/>


<! -- The following would also be nice : -->

  <xsl:variable name='aTemplateReference'>magic1</xsl:variable>

  <xsl:template match="...a mathing expression...">
        <xsl:call-template name="{$aTemplateReference}"/>
  </xsl:template>


 This would add polymorphism to XSL, the caller/user
of a template is not statically linked to a given
implementation, i.e. implementations could be set at runtime...


 Now of course to be usefull one would need
to be able to conditionnally assign values to
{$setOfTemplates} and {$aTemplateReference} ...
ex.:

<xsl:variable name='setOfTemplates'>
    <xsl:value-of select="resolver:resolveVariable('setOfTemplates')"/>

    <!-- I know the specs only allow resolveVariable to be static
         so a 'resolver' is not usefull ... -->
</xsl:variable>

or like in LotusXSL :

  xslProcessor.setStylesheetParam("setOfTemplates",
"'http://anXSLfile.xsl'");
  xslProcessor.process(...);

one can then use :

 <xsl:value-of select="$setOfTemplates"/>


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


Current Thread