I doing the right transformations to develop a multilingual website. All the text of this website needs to be taken from an XML file because the output of the site will be the processed file.
This are the basic files, index.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xsl/index.xsl"?>
<page>
<entry>
<id>12</id>
<value>img/12.jpg</value>
</entry>
<entry>
<id>13</id>
<value>img/13.jpg</value>
</entry>
</page>
This entries are unique so they didn't need to be translated. My index.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- I'm including a language file, but I've various language files that will be stored in different folders -->
<xsl:param name="menu" select="document('../lang/index.xml')" />
<xsl:template match="/">
<html>
<xsl:attribute name="lang"><!-- name of the lang --></xsl:attribute>
<head></head>
<body>
<ul id="menu">
<xsl:for-each select="language/menu">
<li><xsl:value-of select="." /></li>
</xsl:for-each>
</ul>
<!-- this is not important, is an example -->
<xsl:for-each select="page/entry">
<xsl:value-of select="id" />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I include ../lang/index.xml which contains all the words in some language, for example English. I need this site in 3 different languages that can be stored like:
/lang/en/index.xml
<language>
<menu>Home</menu>
<menu>Images</menu>
</language>
/lang/es/index.xml
<language>
<menu>Inicio</menu>
<menu>Imágenes</menu>
</language>
/lang/fr/index.xml
<language>
<menu>Maison</menu>
<menu>Images</menu>
</language>
My question is how I can manage this. I've no option to change that, because I'm not allowed to do a specific index.xsl file for each language.
Thank you in advance and sorry for school English.