loosening restrictions on top-level conditionals/expressions

Greetings,
In relation to a previous topic here ("conditionals not allowed at top
level", 26 April 2001),  I would also like to request this (or equivalent)
functionality, in the form of allowing expressions within
xsl:include/import, or allowing <xsl:element> to be used as a top-level
element.

Given the case where stylesheets are compiled from numerous modules, and
particularly my case, where the language of the modules differ, it would be
desirable to dynamically import/include stylesheet modules for that
language.

Here is a brief example of what I would like to accomplish:

<!-- example document -->
<document language="en">...</document>

<!-- solution 1, previously proposed -->
<xsl:if test="language='en'">
	<xsl:include href="stylesheetModule_en.xsl"/>
</xsl:if>

The next example could be accomplished by relaxing the restrictions on the
import/include elements (allowing expressions to be evaluated).

<!-- solution 2 -->
<xsl:include href="concat('stylesheetModule_',{@language},'.xsl')"/>
<!-- or, $lang supplied at run-time (e.g., command-line) -->
<xsl:include href="concat('stylesheetModule_',{$lang},'.xsl')"/>

This final example could be accomplished by allowing <xsl:element> to be
used as a direct child of <xsl:stylesheet/transform>:

<!-- solution 3 -->
<xsl:element name="xsl:include">
	<xsl:attribute name="href">
		<xsl:value-of select="concat('stylesheetModule_',
@language,'.xsl'"/>
	</xsl:attribute>
</xsl:element>
<!-- or, $lang supplied at run-time (e.g., command-line) --><xsl:element
name="xsl:include">
	<xsl:attribute name="href">
		<xsl:value-of select="concat('stylesheetModule_',
$lang,'.xsl'"/>
	</xsl:attribute>
</xsl:element>

Thanks for your consideration,
John Dunning

Received on Tuesday, 12 March 2002 14:55:37 UTC