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

RE: Multilanguage help

Subject: RE: Multilanguage help
From: "Guillem Rico" <grico@xxxxxxxxxx>
Date: Wed, 15 Feb 2006 09:46:15 +0100
guillem rico
Thanks a lot Antonio,
I'm now testing on your suggestion of yesterday (to search at archives) and
I found a solution like yours.

Once again thank you all.
Impressive list!



-----Mensaje original-----
De: Antsnio Mota [mailto:amsmota@xxxxxxxxx]
Enviado el: miircoles, 15 de febrero de 2006 9:37
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: Re:  Multilanguage help

Extremely easy to do with the document() function. I don't have my XML
tools here but from the top of my head it's something like this:

Supose you have a XML like this

xml_pt.xml

<translations>
    <word id='Descripcion'>Descrigco</word>
   (...)
</translations>

then, in your xsl you should have something that tell what the
language to translate to, a param for instance. Supose you pass 'pt'
to it.

<xsl:param name="lang"/>
<xsl:variable name="filename" select="concat('/filepath/xml_',$lang,'.xml')
/>

and later on instead of

<td class="inici">Descripcion       </td>

you'll have

<td class="inici">
   <xsl:value-of
select="document($filename)/translations/word[@id='Descripcion']
 </td>

and that's it.

Of course you can pass the filename alltogether in the param and avoid
that concat().

This is not tested at all.

Hope it helps.

On 15/02/06, Guillem Rico <grico@xxxxxxxxxx> wrote:
> Ok,
>
> I have a data XML linked to a XSL file.
> This XSL file outputs the contents of that XML file (no problem).
>
> The real problem I have is I want to output the table titles of my xsl
file
> in several languages (spanish, catalan, portuguese, english), and I don't
> want to change from 1 only XSL file to four.
>
>
> A simple example like this:
> (My actual and only XSL):
>
>          <td class="inici">Descripcion       </td>
>          <td class="inici">N                        </td>
>
>
> In catalan should output:
>
>         Descripcis  | N
>
> In english:
>         Description      | N
> .
> .
>
>
> I hope there is a simple way to do it, and I'm thinking the best option,
so
> I consider you could help me (If I've explained it clearly).
>
> Thanks
>
>
> -----Mensaje original-----
> De: Vasu Chakkera [mailto:vasucv@xxxxxxxxxxx]
> Enviado el: miircoles, 15 de febrero de 2006 0:25
> Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Asunto: RE:  Multilanguage help
>
> tell us exactly what you want to do..there could be other ways of doing
the
> same.
> give us an example of what you want.and someone would be able to suggest
you
>
> ways.
>
>
> >From: "Guillem Rico" <grico@xxxxxxxxxx>
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >Subject:  Multilanguage help
> >Date: Tue, 14 Feb 2006 18:16:14 +0100
> >
> >
> >Hi, I'm trying  to do a Multilanguage XSL, but I don't know how...
> >
> >I have a XML file (with data), and the XML is Ok translated, So I only
need
> >to transalte Fields of tables placed into XSL...
> >
> >I think I could store the translations maybe in another XML, but I don't
> >know how to call the another XSL into an XSL (if I could), or wich is the
> >best way to do it
> >
> >I don't know what to do...any ideas??
> >
> >I'm a XSL begginner, please if you could send some examples
> >
> >Thanks
> >
> >
> >
> >
> >
> >.
> >
> >.
> >
> >.
> >
> >.
> >
> ><table border="0" cellpadding="0" cellspacing="0"
> >width="90%"align="center">
> >
> >
> ><xsl:variable name="serv" select="/PICA/DATA/REGISTRE/Servicio" />
> >
> ><tr><td align='right'><ahref="../datos/fr.html?serv={$serv}?t=t">Todos
> ></a>
> >
> ><a href="../datos/fr.html?serv={$serv}?t=2">Quirzrgicos  </a>
> >
> ><a href="../datos/fr.html?serv={$serv}?t=1">Midicos</a></td></tr>
> >
> ></table>
> >
> >
> >
> ><table border="0" cellpadding="0" cellspacing="0"
> >width="90%"align="center">
> >
> >       <tr>
> >
> >                         <td class="inici"> Grd
> ></td>
> >
> >                         <td class="inici">CDM
> ></td>
> >
> >                         <td class="inici" width="3%">T     </td>
> >
> >                         <td class="inici">Descripcion       </td>
> >
> >                         <td class="inici">N
> ></td>
> >
> >                         <td class="inici">PNh
> ></td>
> >
> >                         <td class="inici">PNstd
> ></td>
> >
> >                         <td class="inici">Nobs-Nesp              </td>
> >
> >                         <td class="inici">Peso
> ></td>       </tr>
> >
> >
> >
> >
> >
> >
> >
> >       <xsl:for-each select="PICA/DATA/REGISTRE">
> >
> >       <xsl:sort data-type="number" select="N" order="descending" />
> >
> >
> >
> >       <tr>
> >
> >       <xsl:choose>
> >
> >       <xsl:when test="position() &lt; '20'">
> >
> >       <xsl:choose>
> >
> >.
> >
> >.
> >
> >.
> >
> >.
> >
>
> _________________________________________________________________
> Are you using the latest version of MSN Messenger? Download MSN Messenger
> 7.5 today! http://messenger.msn.co.uk

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.