Re: internationalization via XSL

Subject: Re: internationalization via XSL
From: Nigel Hutchison <nwoh@xxxxxxxxxxxxxx>
Date: Fri, 22 Jan 1999 14:55:13 +0100
At 10:35 AM 1/21/99 -0600, you wrote:
>I have some questions regarding mapping an xml document to different
>via XSL processing, which I assume is a reasonable use of XSL. I also assume
>that there are idioms of usage that cover such needs but I haven't seen any
>discussion of this
>Suppose I have an xml fragment:
>  <mapped-key>surname</mapped-key>
>and I want to use XSL to transform this to:
>  lastname
>if operating in language 'en' and country 'US', to:
>  surname
>for 'en'/'GB', and
>  nom de famille
>for 'fr'.
>I expect to have 1) language mapping files that can be named; and 2) some way
>of conveying to the XSL processor from a controlling application what the
>language and country codes are for an instance of processing.
>What is the canonical way to accomplish 1)  and 2) above using XML/XSL? I
>assume that 2) is accomplished by having the controlling application
>an initial set of constants when the XSL processor is started and is thus an
>implementation matter. What I'm not sure of is what sort of mechanism
would be
>used to handle essentially name/value pairs. Would each language mapping file
>be an XML document? Is there then some way to express in XSL substituting a
>fragment from one tree (the language mapping tree) into the resulting tree
>during a walk of the 'input' xml document? That is can XSL be used to pluck
>pieces from one tree based on nodes in a second tree.
>Is a proper approach to include language/country specific stylesheet
>Sorry if this is a bit confused. I have built a prototype of an ad hoc xml
>based template system and I see how to accomplish most of the
functionality via

Here's what I did. My goal was to make an internationalized instance of an
XSL style sheet that I could give to a document to translate into another
language (to localise it). I declared XSL constants for the bits that
needed translated  I checked the concept out with Koala (finding a few
Koala bugs). I haven't tried this with Ie5.

like this ...

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet xmlns:xsl=''
<!-- Localise values (but not names-->
  <xsl:define-constant name="Delete" value="Delete"/>
  <xsl:define-constant name="Modify" value="Modify"/>
  <xsl:define-constant name="Type" value="Type"/>
  <xsl:define-constant name="Target" value="Target"/>
    <xsl:define-constant name="TargetAccess" value="Target Access"/>
  <xsl:define-constant name="URL" value="URL"/>
  <xsl:define-constant name="Maintain" value="Maintain Directory"/>
  <xsl:define-constant name="Connect" value="Connect"/>
  <xsl:define-constant name="Listen" value="Listen"/>
  <xsl:define-constant name="NewEntry" value="New Entry"/>
<!-- End Localise -->

  <xsl:template match='/'>
	  <xsl:value-of expr='{constant(Maintain)}'/>
	  <xsl:value-of expr="attribute(class)"/>
          <xsl:text> </xsl:text>
          <xsl:value-of expr="attribute(dirparms)"/>

etc. etc


Nigel Hutchison

Nigel W. O. Hutchison
Technical Consultant
Software AG Germany		                              
Tel +49 (0)6151 92 1207                   

 XSL-List info and archive:

Current Thread