Re: [xsl] multilingual web site

Subject: Re: [xsl] multilingual web site
From: "B. Dexheimer" <benjamin.dexheimer@xxxxxxxxxxxxxxxxxx>
Date: Tue, 06 Mar 2001 10:05:18 +0100
I had to deal with the same issue.
Here's what I designed as a multi-language xml structure : 

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<?xml-stylesheet type="text/xml"?>

<PAGE name="the_html_page" content="shtml">
  <TEXT xml:lang='en'>
    <LABEL NEW="no" label_id="1">the first english label of the
page</LABEL>
    ...
  </TEXT>
  <TEXT xml:lang='fr'>
    <LABEL NEW="no" label_id="1">the same first label but in
french</LABEL>
    ...
  </TEXT>
  ...
</PAGE>

and the following piece of xsl processing code :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
		xmlns:xt="http://www.jclark.com/xt";
		extension-element-prefixes="xt">
<xsl:output method="html"/>

<xsl:template match="PAGE">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="TEXTE">
  <xt:document method="html" href="{$page}.{$extension}.{@xml:lang}">
  // the HTML code of the page with
   <xsl:apply-templates select="LABEL[@label_id='1']"/>
  // for inserting labels at the good place
  </xt:document>
</xsl:template>

<xsl:template match="LABEL">
  <xsl:value-of select="."/>
</xsl:template>

You get all the languages packed in only one xml file. the "xt:document"
command allows you to generate physically an html file per language.

I'm already interested by a tool which could automate the work of 
separating labels and html code. I haven't still found no other solution
than writing a perl script or doing it by hand (sigh!).

hope this helps, 

BeNj


> Hi,
> 
> I'm a software engineer and am looking
> for ways to make the internationalization of our web site
> more managable. Currently we maintain seperate html
> documents for each lanaguage. Since the layout of the documents
> is very similar (just the displayed text
> differs in language) I figured there must be a mechanism
> for maintaining a single html document and generating the
> translated html documents from this single document. I'm
> thinking of using xml & xslt as a possible solution. Has
> anyone used similar solutions ?
> I would greatly appreciate any suggestions on this issue
> or if someone could point me to other resources.
> Something with examples would be great.
> 
> I'm envisioning a solution such as:
> 
> an xml file with the following:
> <pagetitle>MY PAGE TITLE IN ENGLISH<pagetitle>
> 
> which would be translated into:
> <pagetitle>MY PAGE TITLE IN ANOTHER LANGUAGE<pagetitle>
> 
> and an XSL (or XSLT) file which would take this XML file and translate
> it into and HTML page.
> 
> We have hundreds of HTML pages and it would be awsome if there
> was a tool out there that could make something like this easier for us.
> 
> Thanks in advance :-)
> -Sher
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread