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

Re: Using XSLT for multi-lingual transforms (was: Re: genera

Subject: Re: Using XSLT for multi-lingual transforms (was: Re: generalpurposetranformation language)
From: Paul Tchistopolskii <paul@xxxxxxx>
Date: Thu, 27 Apr 2000 22:11:20 -0700
multilingual xslt
----- Original Message ----- 
From: Etienne Posthumus 
 
> I have never worked for the translation startup and I don't have a clue
> what those things are... ;-) Any Tips & Enlightenment welcome!

I'm sorry if  my notification was abusing. (  I think I have to use such 
things, to prevent the explanations of  'localhost'  ).

Well .. the tip N1 could be that to maintain large multilingual website 
the simplest solution could be  to assign different http port 
to  each language.  80 to English, 81 to German e t.c. This allows 
to keep the structure of  ( actualy two ) websites the same and 
not to spend much  time on changing the URL's. I mean  you can 
have 

<A href="/somelink.here.xml"> in both vesions of 
the same document, but not 

<A href="/somelink_eng.xml"> in English version and 
<A href="/somelink_german.xml"> in German version.

With such design you have no need to worry about the 
"language mode" when generating the urls  ( because 
the port number is the "language mode" and it is always 
accessible when you need it ). Such thing should minimize 
your need in  multiple stylesheets. There are also 
some other ways, like proxies e t.c. There is realy too 
many different solutions there. 

Unfortunately discussing things like this in more detail
smells like serious offtopic to me, so below I will discuss 
only XSLT-related things.
 
> ---8<---
> > Could you please explain what do you mean by 'some differences' ?
> 
> The stylesheets are used for presentation (or the user interface, in
> my HTML). They contain headings, explanatory text and links to the
> relevant CGI's to fetch the data. So they have small differences in the
> links and headings but are otherwise almost exactly the same.

> Point 1 is handled by the XML server, the XML is generated dynamically so
> there are no 'documents' in a file sense, just XML snippets.
> But to be able to say _which_ XML snippets you want, need to be specified
> in the XSL when the links are generated.

> The single XSL file that I want to be maintained is for consistency (and
> laziness in typing multiple things that are almost the same reasons)

Let us make some experiement. Below comes the 
sample multilingual XSLT stylesheet ( I have tested it with XT ) 
which is driven by one variable  ('lang'). 

I think you can use similiar stylesheet without generating 
'language-specific' stylesheets at all.

Could you please explain why can not you use this design pattern, 
and why should you generate multiple stylesheets instead ?

Rgds.Paul.


<xsl:stylesheet 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 xmlns:xt="http://www.jclark.com/xt"
 version="1.0">


<!-- 
     Variable 'lang' is declared here 
     for demonstration purposes. 
     In the 'real life' it should be obtaned from 
     the 'outher space'
-->

<xsl:variable name="lang">EN</xsl:variable>

<!-- 
     Here is the section which contains all the 
     configurable variables. This is pretty 
     common practice to place all the tuneable 
     places at the top of the script. I think it is 
     *much* better than to generate one script 
     out of another script.
-->

<xsl:variable name="config">

 <heading>
  <DE> German text </DE>
  <EN> English text </EN>
 </heading>

</xsl:variable>

<!-- 
     nod-set hack is used here because XSLT people for some 
     reason do not allow it in the XSLT core. I bet they'l
     change it some day, but for now you should use 
     non-portable typecast. Or you may try to achive the same 
     with document('.') hack. 
-->

<xsl:variable name="cfg" select="xt:node-set($config)"/>

<!--
    Example of language-dependent place
-->

<xsl:template match="/">
    <xsl:value-of select="$cfg/heading/node()[name()=$lang]"/>
</xsl:template>

</xsl:stylesheet>




 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.