Subject: contribute:multilanguage support or multiple files From: juggy@xxxxxxx Date: Sun, 11 Jun 2000 02:14:37 +0200 |
Hi there, I finally found the solution to the problem I mentioned in my previous posts. I just thought, someone could use this. The problem was to have a data xml file, a language xml file and a xsl layout file and have these combined appropriately. This ist test1.xml, the data file: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="test1.xsl" xmlns:xsl="http://www.w3.org/TR/WD-xsl"?> <Daten> <Eintrag id="1">300</Eintrag> <Eintrag id="2">23,42</Eintrag> <Eintrag id="3">4711</Eintrag> </Daten> This is test1l.xml, the language data file: <?xml version="1.0"?> <Sammlung> <Element id="1" spr="de">Kosten</Element> <Element id="2" spr="de">Rueckstellung</Element> <Element id="3" spr="de">Gesamt</Element> <Element id="1" spr="en">Costs</Element> <Element id="2" spr="en">Return</Element> <Element id="3" spr="en">Total</Element> </Sammlung> This is test1.xsl, the layout file: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes"/> <xsl:param name="Sprache" select="'en'"/> <xsl:variable name="file">test1l.xml</xsl:variable> <xsl:variable name="phrases" select="document($file)/Sammlung"/> <xsl:variable name="complete" select="concat($phrases, '/', $Sprache)"/> <xsl:template match="/"> <html> <head> <title>Test1</title> </head> <body> language: <xsl:value-of select="$Sprache"/> <br/> <table border="1"> <xsl:for-each select="/Daten/Eintrag"> <tr> <xsl:variable name="actID" select="@id"/> <td><xsl:value-of select="$phrases/Element[@id=$actID and @spr=$Sprache]"/></td> <td><xsl:value-of select="../Eintrag[@id=$actID]"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> You then just call it via saxon.exe test1.xml test1.xsl Sprache=en (Sprache is the language parameter) Maybe someone can use it. Regards, Juggy XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: your mail, Mike Brown | Thread | rdf, Cheun N Chong |
Re: Can someone please explain:<xsl, Dan Morrison | Date | Re: your mail, Mike Brown |
Month |