<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================= -->
<!-- Copyright © 2009 Maxprograms                       -->
<!-- All rights reserved.                                    -->
<!-- Revision: 7D9-1-F                                      -->
<!-- ======================================================= -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 
    xmlns:gls="http://www.maxprograms.com/gml" exclude-result-prefixes="gls">
    <xsl:output method="xml" encoding="UTF-8" doctype-system="tmx14.dtd"  
        doctype-public="-//LISA OSCAR:1998//DTD for Translation Memory eXchange//EN" indent="yes" />
    <xsl:attribute-set name="xml-lang">
        <xsl:attribute name="xml:lang">
            <xsl:value-of select="attribute::xml:lang"/>
        </xsl:attribute>
    </xsl:attribute-set>
    <xsl:attribute-set name="src-lang">
        <xsl:attribute name="srclang">
            <xsl:value-of select="//attribute::srclang" />
        </xsl:attribute>
    </xsl:attribute-set>
    <xsl:template match="/">
        <tmx version="1.4">
            <header 
                creationtool="Anchovy" 
                creationtoolversion="1.0" 
                xsl:use-attribute-sets="src-lang"
                adminlang="en"  
                datatype="xml" 
                o-tmf="unknown" 
                segtype="block"
                >
                <xsl:apply-templates select="gls:glossary/gls:comment" />
            </header>
            <body>
                <xsl:for-each select="//gls:glossentry">
                    <tu><xsl:apply-templates/></tu>
                </xsl:for-each>
            </body>
            </tmx>
    </xsl:template>
    <xsl:template match="gls:comment">
        <note><xsl:value-of select="node()"/></note>
    </xsl:template>
    <xsl:template match="gls:langentry">
        <tuv xsl:use-attribute-sets="xml-lang">
            <xsl:apply-templates />
        </tuv>
    </xsl:template>
    <xsl:template match="gls:term">
        <seg><xsl:value-of select="node()"/></seg>
    </xsl:template>
    <xsl:template match="gls:definition">
        <prop type="definition"><xsl:value-of select="node()"/></prop>
    </xsl:template>
    
</xsl:stylesheet>
