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

Re: language

Subject: Re: language
From: Paul Warren <xsl-list@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Jul 1999 16:24:42 +0100
paul warren
Miloslav Nic wrote:
> 
> That is tricky. I would sugest following solution, which is not pure,
> but after all, the result is the important thing:
> 
> Use Perl or different language to postprocess your file.

If I understand what you're trying to do correctly, you can do this
using XML Script (http://www.xmlscript.org) like this...

<XST __maxCR='1'>
  <_data>
    <!-- Animals names to translate -->
    <Animal name="Dog" />
    <Animal name="Cat" />

    <!-- Translations -->
    <Trans english="Dog" french="Chien" />
    <Trans english="Cat" french="Chat"  />
  </_data>

  <!-- Template for displaying translations -->
  <_template name="Trans_template">
      <TD> # .french # </TD>
  </_template>

  <!-- Template for displaying animal names -->
  <_template name="Animal_template">
    <TR>
      <TD> # .name # </TD>
      <_process object="\Trans{.english == %.name}" />
    </TR>
  </_template>

  <!-- methods -->
  <_method object="Animal" template="Animal_template" />
  <_method object="Trans" template="Trans_template" />

  <!-- process Animal objects -->
  <_process object="Animal" />

</XST>

The output from this should be:
   
    <TR>
       <TD>Dog</TD>
       <TD>Chien</TD>
    </TR>
    <TR>
       <TD>Cat</TD>
       <TD>Chat</TD>
    </TR>

Is that what you wanted?

yours,

Paul


> > Thanx for your repy.. well, you have a nice solution
> > BUT the problem is that I have an xml file.....
> > I read elements from the xml file and I generate a table with two columns,
> > one for the name of the element and the other for generating a textfield.
> > Well, I will use different xml file, they  have the same structure but of
> > course something changes between different elemens
> > Let's say that I have an xml file containing animals
> > <animal name="dog"></animal>
> > <animal name="cat"></animal>
> > <animal name="cow"></animal>
> > <animal name="mouse"></animal>
> > <animal name="rat"></animal>
> > <animal name="lion"></animal>
> >
> > I will generate a table like
> >
> > Cat     Textfield
> > Cow     Textfield
> > Mouse   Textfield
> > Dog     Textfield
> > Rat     Textfield
> > lion    Textfield
> >
> > Of course I grab the name of each animal from an attribute, but I use
> > <xsl:copy> to copy the name into the table
> > How can I do something like your solution???
> > Keep present also that I won't create the xml file and the xml file couldn't
> > have such as an <!ELEMENT text>
> > Thanx in advance
> > Br
> > marco
> > Marco.Mistroni@xxxxxxxxx wrote:
[...]
> > >
> > > HI all,
> > >         I have one problem: I am using xsl to convert xml into html
> > > I get the name of every attribute using attribute value templates
> > > I would like to display the name of the attribute in a language other than
> > > english....for example french
> > > Anyone knows if it is possible using xsl??
> > > Thanx
> > > Br
> > > marco
> > >


 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.