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

contribute:multilanguage support or multiple files

Subject: contribute:multilanguage support or multiple files
From: juggy@xxxxxxx
Date: Sun, 11 Jun 2000 02:14:37 +0200
html multilanguage support
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

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.