I want to translate a given XML file (it is a RelaxNG grammar) to other languages via XSLT. Suppose the XML file is:
<?xml version="1.0" encoding="UTF-8"?>
<grammar>
<element name="table" />
<element name="chair" />
</grammar>
Now I was thinking of having an XSLT stylesheet with the information like
en=table, de=Tisch, fr=table
en=chair, de=Stuhl, fr=chaise
... (there will be many, many more entries)
But I could also put this information in to an external file (I am starting from scratch). Can you give me advice how to formulate an XSLT? I was thinking of using <xsl:key>
for this but I never get the hang of keys in XSLT. The result should look like this, when I create the German translation:
<?xml version="1.0" encoding="UTF-8"?>
<grammar lang="de">
<element name="Tisch" />
<element name="Stuhl" />
</grammar>
This transformation:
when applied on the provided XML document:
and having the file
C:\temp\delete\dicts.xml
as:produces the wanted, correct result: