W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2002

loosening restrictions on top-level conditionals/expressions

From: Dunning, John <JDunning@goSPS.com>
Date: Tue, 12 Mar 2002 11:21:23 -0500 (EST)
Message-ID: <D026AA7A77E6D311811A00105A867951D5DD82@mail.gosps.com>
To: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:52 GMT