This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Passing Parameters to an XSL stylesheet...
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Passing Parameters to an XSL stylesheet...
- From: Cristobal Galiano Fernandez <c dot galiano at ua dot es>
- Date: Tue, 29 May 2001 11:29:26 +0200
- Organization: Universidad de Alicante
- References: <OFAF46512F.4AC8FF3C-ONC1256A5B.002EA0E7@sgsgroup.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Dagmar! You can see an multilingual example:
1) (Multilingual texts) SammLung.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<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>
2) Data (Daten.xml)
<?xml version="1.0" encoding="ISO-8859-1"?>
<Daten>
<Eintrag id="1">300</Eintrag>
<Eintrag id="2">23,42</Eintrag>
<Eintrag id="3">4711</Eintrag>
</Daten>
3) Example.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- 2000-06-12. Ej-030.XSL
2001-04-10. Juggy (juggy@gmx.net) & CGF
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-Ejemplo de Multilenguaje
.Hay un fichero auxiliar con textos en varios idiomas
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="Sprache" select="'en'"/> <!--
Idioma -->
<xsl:variable name="file">Ej-030-Sammlung.xml</xsl:variable> <!--
Fichero auxiliar Textos-->
<!-- Textos en el idioma seleccionado -->
<xsl:variable name="phrases"
select="document($file)/Sammlung/Element[@spr=$Sprache]"/>
<xsl:template match="/">
<!-- file=<xsl:copy-of select="$phrases" /> -->
<html>
<head>
<title>Test1</title>
</head>
<body>
<br/>
<table border="1">
<caption>(<xsl:value-of select="$Sprache"/>)</caption>
<xsl:for-each select="/Daten/Eintrag">
<xsl:variable name="actID" select="@id"/>
<tr>
<td><xsl:value-of
select="$phrases[@id=$actID]"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
4) Result
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
<title>Test1</title>
</head>
<body><br><table border="1">
<caption>(en)</caption>
<tr>
<td>Costs</td>
<td>300</td>
</tr>
<tr>
<td>Return</td>
<td>23,42</td>
</tr>
<tr>
<td>Total</td>
<td>4711</td>
</tr>
</table>
</body>
</html>
Best Regards
Cristóbal Galiano Fdez.
Dagmar_De_Jong@sgs.com escribió:
> Please help! :-)
>
> I'm trying to develop an XML/XSL page that is multilangual. The only
> things that has to be adjustable corresponding the language, are
> column headings etc... No data offcourse!
> So, I want to load my XML page using my XSL stylesheet, but in stead
> of using things like <TD>Customername</TD>, I want to use variables
> like <TD>VARIABLE_COLUMN1</TD>.
> This way I can put al the variable declarations in a separate file (I
> thought about an "language.inc" file for example). But I don't have
> any idea how I can: 1) include a non-xsl file in my XSL stylesheet and
> 2) how to use the variables in the stylesheet!!!
>
> I hope somebody can help me.... If something is not clear, PLEASE,
> ask further info!!!
> Thnx a million!!
>
> Streep
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list