Re: loosening restrictions on top-level conditionals/expressions

I am very much in favour of this proposal. Conditional inclusion is a must.
Such functionality also exists in LaTeX for example.

I would go for solutions 1 and 2 though, not 3. xsl:element is used in the
construction of the result tree, while our goal is to assemble the style sheets
which will be used to construct the result tree.

Werner.

Dunning, John wrote:

> 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
> 
> 
> 
> 
> 


-- 
Werner Donné  --  Re BVBA
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803	e-mail: werner.donne@re.be

Received on Wednesday, 13 March 2002 06:40:03 UTC