Further comments on xsl:include

I previously suggested that xsl:include allow XSL expressions for the
href attribute (or alternatively as an alternate 'expr' attribute which
replaces the href attribute in such cases).

Someone else suggested another possibility which I would like to
re-iterate:

If xsl:include was allowed elsewhere besides at the top-level of the
stylesheet, then one could work around the lack of inclusion
expressions.

For example:

<!-- main xsl file -->
<xsl:stylesheet>
  <xsl:param-variable name='locale'>en</xsl:param-variable>
  <xsl:include href="translationBundle.xsl"/>
  <!-- other xsl stuff -->
</xsl:stylesheet>

<!-- translationBundle.xsl -->
<xsl:stylesheet>
  <xsl:choose>
    <xsl:when test='starts-with($locale,"en")'>
      <xsl:include href="translationBundle_en.xsl"/>
    </xsl:when>
    <!-- other cases follow -->
  </xsl:choose>
</xsl:stylesheet>

This brings up a question:  How are input parameters dealt with during
inclusion evaluation?

The example above uses a 'locale' variable which is intended to
propagate from the top stylesheet into the translationBundle.xsl sheet
where it selects the appropriate translation bundle.  This obviously
makes certain assumptions about the handling of param-variable's.

Received on Tuesday, 29 June 1999 10:10:29 UTC