[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: localization using <xsl:key> help
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|