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

Re: localization using <xsl:key> help

Subject: Re: localization using <xsl:key> help
From: Mike Engelhart <mengelhart@xxxxxxxxxxxxx>
Date: Thu, 09 Mar 2000 18:04:07 -0600
localization using java
David_Marston@xxxxxxxxx wrote:

> How about having several keyspaces, one for each language, then use a
> parameter or expression as the first argument to key()? I think what you
> are trying to do is a two-way lookup, presuming that you have more than
> just _FIRST_NAME to be translated. So you need to generate the correct
> string for a given term (_FIRST_NAME or whatever) *and* a specified
> language.

I'm not sure I completely understand your answer so let me clarify my
question :-)

I am generating dynamic XML with Cocoon, so I have access to the browser
language at the time a request is made so in the XML that is passed to the
stylesheet, I will know the language for the whole page.   I want all text
labels, menus and buttons in the resulting HTML to be in the language that
the users browser was set to (and fall back to english if none match). (I'm
currently succesfully doing this using Xalan's java extensions and
java.util.RessourceBundle's, but I want a language neutral way of doing this
if possible).

Anyway, I thought that there would be some XSL expression using keys that
would let me access the correct <translation> element based on the language.
For example here's the example localization.xml file:

<localization>
    <word name="_FIRST_NAME">
        <translation lang="en">First Name</translation>
        <translation lang="es">Nombre</translation>
        <translation lang="it">Nome</translation>
    </word>
</localization>

Since I already know that all lookups for the current transform are going to
be for spanish is there any way I can setup the <xsl:key ...> element to
only choose the <translation> elements that have an "es" attribute?

<xsl:key name="translate" match="word" use="@name"/>
<!-- this just get's the "en" or first element -->

thanks a lot,

Mike


 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.