<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 20091102 -->
<!--    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:output method="text"/>
<xsl:template match="lexeme">
<xsl:for-each select="phoneme">
 <xsl:variable name="frenchword">
  <xsl:if test="contains(., '/')">
    <xsl:value-of select="substring-before(., '/')"/>
  </xsl:if>
  <xsl:if test="not(contains(., '/'))">
   <xsl:value-of select="."/>
  </xsl:if>
 </xsl:variable>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã¨','è')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã¢','â')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã®','î')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã©','é')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã§','ç')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã®','û')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Å&#147;','œ')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã»','û')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã´','ô')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ãª','ê')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã¦','æ')"/><!--xad,xal-->
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã¼','ü')"/><!--xah-->
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã¯','ï')"/><!--xak-->
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã ','à')"/><!--xal-->
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã','É')"/>
 <xsl:variable name="frenchword" select="replace($frenchword, 'Ã','Î')"/>
 <!--xao: unsolved "Ã-peu-près"-->
 <xsl:variable name="frenchword">
  <xsl:choose>
  <xsl:when test="starts-with($frenchword, 's,')">
   <xsl:sequence select="substring-after($frenchword, 's,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'c,')">
   <xsl:sequence select="substring-after($frenchword, 'c,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'd,')">
   <xsl:sequence select="substring-after($frenchword, 'd,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'l,')">
   <xsl:sequence select="substring-after($frenchword, 'l,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'quoiqu,')">
   <xsl:sequence select="substring-after($frenchword, 'quoiqu,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'puisqu,')">
   <xsl:sequence select="substring-after($frenchword, 'puisqu,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'lorsqu,')">
   <xsl:sequence select="substring-after($frenchword, 'lorsqu,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'qu,')">
   <xsl:sequence select="substring-after($frenchword, 'qu,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'jusqu,')">
   <xsl:sequence select="substring-after($frenchword, 'jusqu,')"/>
  </xsl:when>
  <xsl:when test="starts-with($frenchword, 'j,')">
   <xsl:sequence select="substring-after($frenchword, 'j,')"/>
  </xsl:when>
  <xsl:otherwise>
   <xsl:sequence select="$frenchword"/>
  </xsl:otherwise>
  </xsl:choose>
 </xsl:variable>
 
 <xsl:variable name="frenchword">
  <xsl:choose>
   <xsl:when test="ends-with($frenchword, '0')">
    <xsl:sequence select="replace($frenchword, '0', '')"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:sequence select="$frenchword"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:variable>

 <xsl:choose>
  <xsl:when test="ends-with($frenchword, 'A')">
  </xsl:when>
  <xsl:when test="contains($frenchword, 'cern')">
  </xsl:when>
  <xsl:when test="not($frenchword='')"><xsl:text>
</xsl:text>
   <xsl:element name="audio">
    <xsl:sequence select="$frenchword"/>
   </xsl:element>
  </xsl:when>
</xsl:choose>

</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

