|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: internationalization via XSL
At 10:35 AM 1/21/99 -0600, you wrote:
>I have some questions regarding mapping an xml document to different
languages
>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
establish
>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
>components?
>
>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
>XSL.
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='http://www.w3.org/TR/WD-xsl'
xmlns:html="http://www.w3.org/TR/REC-html40/"
result-ns="html">
<!-- 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='/'>
<html>
<head>
<title>
<xsl:value-of expr='{constant(Maintain)}'/>
<xsl:value-of expr="attribute(class)"/>
<xsl:text> </xsl:text>
<xsl:value-of expr="attribute(dirparms)"/>
</title>
etc. etc
regards
Nigel Hutchison
Nigel W. O. Hutchison
Technical Consultant
Software AG Germany
mailto:nwoh@xxxxxxxxxxxxxx
Tel +49 (0)6151 92 1207
*
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
|

Cart








