Subject: internationalization / localization of XSLT output From: Stephan.Otte@xxxxxx Date: Thu, 24 Aug 2000 14:50:35 +0200 |
Hello, I'd like to transform the contents of XML-files to localized HTML (english, german, french etc.) using only *one * XSL stylesheet. My task is just to translate strings out of the XSL stylesheet. I do not need to have different formatting instructions. One approach (found at w3.org) is to use additional input files (one for each language) containing the translated strings. E.g. ge.xml for the german translation, fr.xml for the french as given below: <!-- ----------- english "translation" file en.xml ----- --> <strings> <str name="Results of database query">Results of database query</str> <str name="next page">next page</str> </strings> <!-- --------- german translation file ge.xml ----- --> <strings> <str name="Results of database query">Ergebnis der Datenbankabfrage</str> <str name="next page">naechste Seite</str> </strings> <!-- ------------------- XSL stylesheet ---------------- ---> <xsl:param name="lang"/> <!-- param set in command line --> <xsl:variable name="loc" select="document( concat( $lang, '.xml' ))/strings"/> <html> <body> <h1><xsl:value-of select="$loc/str[@name='Results of database query']"/> </h1> In my opinion the reference to the string seems to be a little bit to complicated so I don't like this approach very much. Another approach is to use entities for the strings which are defined in different external DTD files, one for each language. The reference would be much simpler. But because I want to have the english version of the string in the XSL-stylesheet, the entity would be referenced like "&Results_of_the_database_query;". Looks a bit curios, doesn't it?! Also the possibility of typing errors is high. Apart from this I don't know how to include different DTDs depending on the language dynamically. Does anyone know how to do this? (I use the Xalan XSLT-Processor on the command line.) As you see I´m not pleased with these approaches, possibly because I use the very nice gettext mechanism for localizing C sourcecode. Finally, here is my question: Are there any other solutions for localization / internationalization XSLT output? Thanks, Stephan XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: SUMMARY: Selecting unique value, Dimitre Novatchev | Thread | RE: internationalization / localiza, Chris Bayes |
RE: WYSIWYG XSL Editors, Jim Dorey | Date | RE: WYSIWYG XSL Editors, Chris Bayes |
Month |