<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--    20091107 -->
<!--    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:template name="create">
<xsl:for-each select="audio">
 <xsl:variable name="frenchword">

  <xsl:choose>
  <xsl:when test="contains(., '/')">
   <xsl:variable name="endswith-s">
    <xsl:value-of select="substring-before(., '/')"/>
    <xsl:text>s</xsl:text>
   </xsl:variable>
   <xsl:sequence select="$endswith-s"/>
  </xsl:when>

  <xsl:otherwise>
   <xsl:value-of select="."/>
  </xsl:otherwise>
  </xsl:choose>

 </xsl:variable>

<xsl:if test="not($frenchword='')">
 <xsl:text>
</xsl:text>
 <xsl:element name="audio">
  <xsl:sequence select="$frenchword"/>
 </xsl:element>
</xsl:if>

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


<xsl:template match="speak">
<xsl:element name="speak">
<xsl:call-template name="create"/><xsl:text>
</xsl:text>
</xsl:element>
</xsl:template>


</xsl:stylesheet>

