Sγntαx
Po polsku
English
Zamiast CV
Łącza
Licznik znaków
Makra/Macros
Contact

An XSLT transformation which creates a text file from Multiterm XML format

Added: 22 August 2009

Your client provides you with a Multiterm termbase or an XML export of it. You want to use it in a different CAT tool, but most tools do not recognize this proprietary XML format. To make things worse, the export options available in Multiterm are far from perfect. But all hope is not lost. You can use an XSLT transformation to obtain a tab delimited text file from the XML file you exported from Mutltiterm or obtained from your client.

Here is the code of the XSLT transformation and an explanation how to use it follows:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" />

<xsl:template match="/*">
<xsl:for-each select="conceptGrp">
    <xsl:for-each select="languageGrp/termGrp/term">
        <xsl:value-of select="."/><xsl:text>    </xsl:text>
    </xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

To use the XSLT transformation you need to save it as a file with the xsl extension. For your convenience, you can download the file here.

You will also need a piece of software called an XSLT processor. There are a number of XSLT processor available, such as:

To learn how to perform the XSLT transformation using the tool you choose, please refer to the help messages/files provided with the tool.

NOTE:

So, after you export the xml file from Multiterm, you need to convert its encoding from utf-16 to utf-8 (for example in UltraEdit, NotetabPro 6.1, or even MS Word or OpenOffice Writer) and you also need to change the encoding declaration in the xml file near the top of the file from encoding="utf-16" to encoding="utf-8"

After saving the file you can run the following from the command line:

		msxsl multitermglossary.xml mtbl2txt.xsl -o textfile.csv

If you don't want to play around with encoding conversions, you need to download and install AltovaXML (it is free), add the path to altovaxml in your system settings so that you can use it anywhere in your file system, and run from the command line:

		AltovaXML -xslt1 mtbl2txt.xsl -in multitermglossary.xml -out textfile.csv

AltovaXML will recognize that the input file is encoded in utf-16, and will even convert the output file to utf-8, as declared in the transfrormation sheet, in this line:

		<xsl:output method="text" encoding="utf-8" />

Hope you find this XSL sheet useful.

Last updated: 31 October 2009