Altova Mailing List Archives


xsl:include with a computed filename

From: Simon Brooke <stillyet@----------.--->
To: NULL
Date: 5/26/2008 7:14:00 AM
I'm trying to do internationalisation by using xsl:include to include
a different file depending on the locale setting, and I'm completely
failing.

I've tried several different approaches:


	<xsl:include href="concat( 'i18n-', $locale, '-include.xslt)"/>

fails with XSLT compile error: FileNotFoundException
---------------------
Could not find file 'C:\Projects\ADL\transforms01\concat( 'i18n-',
$locale, '-include.xslt)'.


	<xsl:include>
		<xsl:attribute name="href">
			<xsl:value-of select="concat( 'i18n-', $locale, '-include.xslt)"/>
		</xsl:attribute>
	</xsl:include>

fails with 'Missing mandatory attribute'


	<xsl:param name="i18n-include" select="i18n-en-GB-include.xslt"/>

	<xsl:include href="$i18n-include"/>

fails with XSLT compile error:.FileNotFoundException
---------------------
Could not find file 'C:\Projects\ADL\transforms01\$i18n-include'.


xsl:choose is not a valid child of xsl:stylesheet, so I can't do at
top level

    <xsl:choose>
        <xsl:when test="$lang='en-GB'">
            <xsl:include href='i18n-en-GB-include.xslt'/>
        </xsl:when>
    </xsl:choose>

I'm running out of ideas. If anyone has successful recipes for
conditional include in XSL I'd love to hear them.

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.