W3C home > Mailing lists > Public > public-i18n-geo@w3.org > March 2005

DRAFT I18N GEO FAQ: XSLT FOR MULTILINGUAL OUTPUT

From: Deborah Cawkwell <deborah.cawkwell@bbc.co.uk>
Date: Wed, 9 Mar 2005 19:26:47 -0000
Message-ID: <418B7E44473AC34488C9E730D09FF3CF0517907F@bbcxue204.national.core.bbc.co.uk>
To: <public-i18n-geo@w3.org>

Please comment. Suggestions for the Further Reading section are also welcomed as are also ideas for other XSLT FAQs.

Thanks

Deborah

----------------------------

DRAFT FAQ: XSLT FOR MULTILINGUAL OUTPUT

Question

How do I output multilingual documents from XSLT where different information is required for different languages there is essentially have the same look & feel?


Background

You output web resources for multilingual web resources where the output is essentially the same in terms of:
- Page layout for HTML or document structure for RSS.
- Vocabulary, eg, 'latest news' in whatever language.
- Language information, ie, each page should have appropriate language tags, eg x for x language.
- Character encoding information, ie, each page should have appropriate encoding, eg x for x language.

You might want to change some of this information, eg:
- Vocabulary: 'latest news' in whatever language becomes 'news: up to the minute' or a form disclaimer.
- Encoding: x encoding to utf-8.

You might consider hard-coding this information into the XSLT, which could involve many switches, eg with <xsl:choose><xsl:when>, etc. 

Problems:
- You are not separating concerns in terms of presentation & business logic, which is proven, good software engineering practice.
- Your XSLT will be overly bloated with output-specific information, making it difficult to focus on the script.
- XSLT expertise is required for what is essentially a text-editing change.
- Lack of knowledge in editing the XSLT could create problems, eg, preventing users of an XSLT-driven CPMS system from producing pages.


Answer

Use a separate XML 'config' to specify language-specific information, such as:
- Character encoding
- Language tag
- Vocabulary

Ensure that the XML config is well-formed &/or valided against a schema/DTD before made operational.

If there is language-specific data in the XML config ensure that:
- The XML encoding value is the same as the encoding used for the web output of that language, [add example].
- The file is saved appropriately, eg, if using utf-8 encoding, save the file as utf-8, otherwise save the file as ASCII.


By the way

You could also provide the XML config information in the XML file containing the new page information. If working with the database, this information could be stored there. However, regarding updating that information, you could incur a similar problem to hard-coding it into the XSLT, ie, a requirement for database knowledge in order to update that information.


Further reading

[to be added]





http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.
Received on Wednesday, 9 March 2005 19:26:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:12:39 GMT