This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: multi language support
- To: "Alankar Chowdhury" <alankar at crtc dot corp dot mot dot com>
- Subject: Re: multi language support
- From: Jeni Tennison <Jeni dot Tennison at epistemics dot co dot uk>
- Date: Thu, 25 May 2000 10:45:14 +0100
- Cc: xsl-list at mulberrytech dot com
- Reply-To: xsl-list at mulberrytech dot com
Alankar,
At 09:52 AM 5/25/00 +0200, Sydney wrote:
>To support multi-language, you can use something like
>that
>
><pagecontent>
><desc xml:lang="fr">Bonjour</desc>
><desc xml:lang="en">Hello</desc>
></pagecontent>
>
>When you use xslt, you specify the language as a
>parameter of your xsl file.
><xsl:stylesheet>
><xsl:param name="lang"/>
Just to follow on from Sydney's suggestion, you should use the lang()
function as a shortcut to test whether the language specified in your
document using the xml:lang attribute matches the language specified by the
$lang parameter. This saves you from having to test for different
capitalisations or subcodes like 'en-GB' in the value of the xml:lang
attribute. More importantly, it takes into account the fact that xml:lang
is an attribute that is inherited by child elements. For example:
<xsl:template match="desc">
<xsl:if test="lang($lang)">
<xsl:copy-of select="." />
</xsl:if>
</xsl:template>
Cheers,
Jeni
Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 • Fax 0115 9061304 • Email
jeni.tennison@epistemics.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list