XSLT_TAO/conversion_TMX_en_TBX/tmx2tbx.xsl

62 lines
1.7 KiB
XML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version='1.0' encoding="UTF-8"?>
<!--
Ce document est une tentative pour créer une transformation XSL (XSLT) simple entre un fichier TMX (mémoire de traduction) et un fichier TBX (glossaire).
Vous trouverez des explications détaillées ici:
https://mac4translators.blogspot.com/2023/04/convertir-un-fichier-tmx-en-tbx-avec.html
Le document est un logiciel libre qui est utilisable et modifiable selon les termes de la licence GPL 3.0 (ou plus).
Copyright Sirine Ben Hadj Khalifa, Jean-Christophe Helary
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:local="http://www.w3.org/2005/xquery-local-functions">
<xsl:output method="xml" encoding="UTF-8" indent="yes" doctype-public="ISO 12200:1999A//DTD MARTIF core (DXFcdV04)//EN" doctype-system="TBXcdv04.dtd" />
<xsl:template match="/">
<martif type="TBX" xml:lang="en">
<martifHeader>
<fileDesc>
<sourceDesc>
<p>tmx2tbx</p>
</sourceDesc>
</fileDesc>
</martifHeader>
<text>
<body>
<xsl:apply-templates select="tmx/body/tu"/>
</body>
</text>
</martif>
</xsl:template>
<xsl:template match="tmx/body/tu">
<termEntry>
<xsl:attribute name="id">
<xsl:value-of select="tuv[1]/seg"/>
</xsl:attribute>
<note xml:lang="en">UI</note>
<xsl:apply-templates select="tuv"/>
</termEntry>
</xsl:template>
<xsl:template match="tuv">
<langSet>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
<xsl:apply-templates select="seg"/>
</langSet>
</xsl:template>
<xsl:template match="seg">
<tig>
<term>
<xsl:value-of select="."/>
</term>
</tig>
</xsl:template>
</xsl:stylesheet>