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

Re: Translating grammars XML in others languages

Subject: Re: Translating grammars XML in others languages
From: "Carsten Klein" <carstenklein@xxxxxxxx>
Date: Wed, 3 Jul 2002 10:59:32 +0200
xsl find node
Hi Paolo,

I had a small glimpse on your code and the last template you are trying to
use will not work because you
may not apply templates to a node-set inside a variable.

Why don't you apply the stylesheet you have defined directly to the document
and passing additional information,
such as the language to which the document is to be translated to the
stylesheet?

You would then be able to use

<xsl:template match="/">
word - Need to be a qname-->
 <xsl:apply-templates/>
</xsl:template>

=).

You must re-define your system for the translation to use either, multiple
stylesheets and transformations or
use the documents holding the information on translation simply as a lookup
table, i.e. a document which
contains all the element and attribute names in the original language and
the corresponding names in the target language:


    <translation lang="Spanish">
        <element name="DADOS-GERAIS" translation="WHATEVER_THIS_MEANS"/>
        <attribute name="DATA-ATUALIZACAO" translation="CHANGED"/>
    </translation>

You then may reference this document, using

  <xsl:variable name="vTranslation"
 select="document(concat("translations", $Global_Language_Parm, ....))"/>

now, you write a generic translation stylesheet which takes an arbitrary
language source document, having only three or four basic
templates

    one for the document root
    one for element nodes
    one for attribute nodes
    one template to match 'em all =)

<xsl:template match="/">
word - Need to be a qname-->
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="node()">
word - Need to be a qname-->
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="@*">
word - Need to be a qname-->

    <xsl:attribute name="$vTranslation/...

<!--
find node which matches the local-name of the current attribute node in the
translation document and get the value of the translated attribute name from
it
...
-->

 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
    <!-- other nodes (CDATA/Comment...) -->
    <xsl:copy>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>


Hope this gives you an idea of how to make this translation of yours more
generic and universal.


Bye

Carsten


 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.