This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Using XSLT for multi-lingual transforms (was: Re: generalpurposetranformation language)
- To: xsl-list at mulberrytech dot com
- Subject: Re: Using XSLT for multi-lingual transforms (was: Re: generalpurposetranformation language)
- From: Paul Tchistopolskii <paul at qub dot com>
- Date: Thu, 27 Apr 2000 22:11:20 -0700
- Organization: The Qub Group
- References: <Pine.LNX.4.10.10004271104470.22819-100000@pcm1733.let.uu.nl>
- Reply-To: xsl-list at mulberrytech dot com
----- 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