<?xml version="1.0" encoding="UTF-8"?>
<!--	This style-sheet is licensed under the GPLv3.
        Read the full license text: http://script.blau.in/etc/GPL_License -->
<!--    This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 3 of the License, or
        (at your option) any later version.
        
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
        
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
        MA 02110-1301, USA. -->
<!--    Created by Ralf Herzog in May 2010 -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="lexicon"><xsl:text>
</xsl:text><xsl:comment>    Removed substring after slash (version 0.1; May 12, 2010) </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment>    This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 3 of the License, or
        (at your option) any later version.
        
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
        
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
        MA 02110-1301, USA. </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment>	This is licensed under the GPLv3.
        Read the full license text: http://script.blau.in/etc/GPL_License </xsl:comment><xsl:text>
</xsl:text>
<speak>

<xsl:for-each-group select="lexeme" group-by="grapheme">
 <xsl:sort select="grapheme" order="ascending"/>
 <xsl:call-template name="create-latin-lexeme-element"/>
</xsl:for-each-group><xsl:text>
</xsl:text>
</speak>
</xsl:template>

<xsl:template name="create-latin-lexeme-element">
 <xsl:variable name="current-latin-lexeme">  
<!-- <xsl:text>
 </xsl:text>
 <xsl:element name="lexeme">-->
  <xsl:call-template name="create-latin-grapheme-element"/><!--
  <xsl:call-template name="create-assamese-phoneme-element"/><xsl:text>
 </xsl:text>--><!--
 </xsl:element>-->
 </xsl:variable>
 <xsl:sequence select="$current-latin-lexeme"/>
</xsl:template>

<xsl:template name="create-latin-grapheme-element">
 <xsl:variable name="current-grapheme">
  <xsl:choose>
  <xsl:when test="contains(grapheme, '/')">
   <xsl:value-of select="substring-before(grapheme, '/')"/>
  </xsl:when>
  <xsl:otherwise>
   <xsl:value-of select="grapheme"/>
  </xsl:otherwise>
  </xsl:choose>
 </xsl:variable><xsl:text>
  </xsl:text>
 <xsl:element name="audio"><xsl:sequence select="$current-grapheme"/></xsl:element>
</xsl:template>

</xsl:stylesheet>

