Re: language

Subject: Re: language
From: Miloslav Nic <nicmila@xxxxxxxx>
Date: Fri, 16 Jul 1999 15:38:16 +0200
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.
something like (I have not tested the code, if you need, I could help
you with this bit)
while ($source=~/<animal .*?name *?= *?[",'](.*?)[",']/)
{
$animal = $1;
}

and than look for translation in some table.
At zvon site I am doing e.g. changes from internal id in hrefs to URL. 
I is my attempt to mimck some behaviour of XLink and it actually works
magnificantly. If this did not work. I would already been lost in my
project.

Marco.Mistroni@xxxxxxxxx wrote:
> 
> Hi Miroslav,
>                         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
> 
> -----Original Message-----
> From:   EXT Miloslav Nic [mailto:nicmila@xxxxxxxx]
> Sent:   16. July 1999 12:59
> To:     xsl-list@xxxxxxxxxxxxxxxx
> Subject:        Re: language
> 
> I would use xsl:if constructs.
> 
> I am solving language problems in following way:
> I do not use attributes for anything what needs translation, but I
> declare
> e.g. <!ELEMENT text (#PCDATA|trans)*>
> Then I can either write
> <text>blablabla</text>
> or <text>blablaaaa<trans lang="cs">asasssa</trans><trans
> lang="en">sdsdd</trans></text>
> 
> Then you can use in your XSL constructs like:
> <xsl:choose>
>   <xsl:when test='trans[@lang=$language]'>
>   <xsl:value-of select="trans[@lang=$language]"/>
>   </xsl:when>
>   <xsl:when test='trans[not(@lang)] and /*/@translang=$language'>
>   <xsl:value-of select="trans[not(@lang)]"/>
>   </xsl:when>
>   <xsl:otherwise>
>   <xsl:value-of select="./text()"/>
>   </xsl:otherwise>
>   </xsl:choose>
> 
> Look at http://zvon.vscht.cz/ZvonHTML/Zvon/zvonHomepage_en.html for
> details
> (click at XSL and then on generalTemplates_1_00.xsl)
> 
> 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
> 
> --
> ***************************************************************
> Dr. Miloslav Nic                        e-mail: nicmila@xxxxxxxx
> Department of Organic Chemistry         TEL: +420 2 2435 5012
> ICT Prague (VSCHT Praha)                     +420 2 2435 4118
>                                         FAX: +420 2 2435 4288
> ****************************************************************
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
***************************************************************
Dr. Miloslav Nic                        e-mail: nicmila@xxxxxxxx
Department of Organic Chemistry         TEL: +420 2 2435 5012  
ICT Prague (VSCHT Praha)                     +420 2 2435 4118
    				        FAX: +420 2 2435 4288  
****************************************************************


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


Current Thread