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

An XSLT transformation which creates a HTML preview of a TMX file

Added: 22 August 2009

Your client sends you a TMX file to use. You want to have a look at its contents. You can:

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="html" encoding="utf-8" indent="yes" />

<xsl:template match="/tmx/body">
<html>
    <head>
        <title>
            TMX Table
        </title>
    </head>
    <body>
        <table border="1" cellpadding="5">
            <tr>
                <td>Source</td>
                <td>Translation</td>
            </tr>
                <xsl:apply-templates/>
        </table>
    </body>
</html>
</xsl:template>

<xsl:template match="tu">
<tr>
    <xsl:apply-templates/>
</tr>
</xsl:template>


<xsl:template match="tuv">
<td>
    <xsl:apply-templates/>
</td>
</xsl:template>

<xsl:template match="seg">
<xsl:value-of select="."/>
</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.

Last updated: 01 June 2010