<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================= -->
<!-- Copyright © 2009-2010 Maxprograms                       -->
<!-- All rights reserved.                                    -->
<!-- Revision: 7DA-8-C                                       -->
<!-- ======================================================= -->
<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="TBXcoreStructV02.dtd" indent="yes" />
    <!-- Common Attribute Sets -->
    <xsl:attribute-set name="xml-lang">
        <xsl:attribute name="xml:lang">
            <xsl:value-of select="attribute::xml:lang"/>
        </xsl:attribute>
    </xsl:attribute-set>
    <!-- Templates -->
    <xsl:template match="/">
        <martif type="TBX" xml:lang="en">
            <martifHeader>
                <fileDesc>
                    <sourceDesc>
                        <p>Generated with glossml2tbx.xsl</p>
                        <xsl:apply-templates select="gls:glossary/gls:comment" />
                    </sourceDesc>
                </fileDesc>        
                <encodingDesc>
                    <p type="XCSURI">http://www.lisa.org/fileadmin/standards/tbx/TBXXCSV02.XCS</p>                    
                </encodingDesc>
            </martifHeader>
            <text>
                <body>
                    <xsl:for-each select="//gls:glossentry">
                        <termEntry>
                            <xsl:apply-templates select="child::gls:comment"/>
                            <xsl:apply-templates select="child::gls:langentry"/>    
                        </termEntry>
                    </xsl:for-each>                    
                </body>
            </text>
        </martif>
    </xsl:template>
    <xsl:template match="gls:langentry">
        <langSet xsl:use-attribute-sets="xml-lang">
            <tig>
                <xsl:apply-templates select="child::gls:term" />
                <xsl:apply-templates select="child::gls:definition" />
            </tig>
        </langSet>
    </xsl:template>
    <xsl:template match="gls:term">
        <term>
            <xsl:value-of select="node()"/>
        </term>
    </xsl:template>
    <xsl:template match="gls:definition">
        <descrip type="definition"><xsl:value-of select="node()"/></descrip>
    </xsl:template>
    <xsl:template match="gls:glossentry/gls:comment">
        <note><xsl:value-of select="node()" /></note>
    </xsl:template>
    <xsl:template match="gls:glossary/gls:comment">
        <p><xsl:value-of select="node()" /></p>
    </xsl:template>
</xsl:stylesheet>
