[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

internationalization / localization of XSLT output

Subject: internationalization / localization of XSLT output
From: Stephan.Otte@xxxxxx
Date: Thu, 24 Aug 2000 14:50:35 +0200
xslt internationalization
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.