<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				xmlns="www.w3.org/2002/08/xhtml/xhtml1-strict.xsd‎"
				xmlns:src="http://www.facture.com"
				>
<xsl:template match="src:facture">
  <html>
  <body>
    <h2>Facture <xsl:value-of select="@date" /></h2>
	<xsl:apply-templates select="src:client"/>
	<xsl:apply-templates select="src:vente"/>
  </body>
  </html>
</xsl:template>

<xsl:template match="src:client">
    <table border="1">
    	<tr>
    		<th colspan="2">Client</th>
    	</tr>
        <tr>
        	<td>nom</td>
        	<td><xsl:value-of select="src:nom"/></td>
        </tr>
        <tr>
          <td>prenom</td>
          <td><xsl:value-of select="src:prenom"/></td>
        </tr>
        <tr>
          <td>adresse</td>
          <td><xsl:value-of select="src:adresse"/></td>
        </tr>
        <tr>
          <td>codepostal</td>
          <td><xsl:value-of select="src:codepostal"/></td>
        </tr>
	    <xsl:for-each select="src:telephone">
      	<tr>
        	<td>telephone <xsl:value-of select="./@type"/></td><td><xsl:value-of select="."/></td>
        </tr>
		</xsl:for-each>
        <tr>
          <td>courriel</td>
          <td><xsl:value-of select="/src:courriel"/></td>
        </tr>
	</table>
</xsl:template>

<xsl:template match="src:vente">
    <table border="1">
      <tr>
        <th>nom</th>
        <th>code</th>
        <th>quantite</th>
        <th>prix</th>
        <th>taxe</th>
      </tr>
      <xsl:for-each select="src:article">
        <tr>
          <td><xsl:value-of select="src:nom"/></td>
          <td><xsl:value-of select="src:code"/></td>
          <td><xsl:value-of select="src:quantite"/></td>
          <td><xsl:value-of select="src:prix"/></td>
          <xsl:if test="@taxable = true">
          <td><xsl:value-of select="src:prix * 0.15"/></td>
          </xsl:if>
        </tr>
      </xsl:for-each>
    </table>
</xsl:template>

</xsl:stylesheet>