<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:template match="/">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Sound report</title>
  <link rel="stylesheet" href="soundreport.css" type="text/css"/>
 </head>
 <body>
  <h1>Sound report for roll <xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/TAPE"/></h1>
  <table class="session">
   <tr>
    <td>
     <table>
      <tr>
       <th>Title:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/PROJECT"/></td>
      </tr><tr>
       <th>Date:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/BEXT/BWF_ORIGINATION_DATE"/></td>
      </tr><tr>
       <th>Roll:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/TAPE"/></td>
      </tr><tr>
       <th>Mixer:</th>
       <td class="pre"><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/VOSGAMES/CONTACT_INFO"/></td>
       </tr>
     </table>
    </td><td>
     <table>
      <tr>
       <th>Software:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/BEXT/BWF_ORIGINATOR"/></td>
      </tr><tr>
       <th>Bit depth:</th>
       <td>
        <xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/AUDIO_BIT_DEPTH"/> bit (<xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/AUDIO_ENCODING"/>)
       </td>
      </tr><tr>
       <th>Device SR:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/HARDWARE_SAMPLE_RATE"/> Hz</td>
      </tr><tr>
       <th>Audio SR:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/DIGITIZER_SAMPLE_RATE"/> Hz</td>
      </tr><tr>
       <th>File SR:</th>
       <td><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/FILE_SAMPLE_RATE"/> Hz</td>
      </tr><tr>
       <th>Frame Rate:</th>
       <td xml:space="preserve"><xsl:choose>
         <xsl:when test="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE = '24000/1001'">23.98</xsl:when>
         <xsl:when test="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE = '24/1'">24</xsl:when>
         <xsl:when test="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE = '25/1'">25</xsl:when>
         <xsl:when test="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE = '30000/1001'">29.97</xsl:when>
         <xsl:when test="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE = '30/1'">30</xsl:when>
         <xsl:otherwise><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_RATE"/></xsl:otherwise>
        </xsl:choose> <xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/SPEED/TIMECODE_FLAG"/></td>
      </tr>
     </table>
    </td><td>
     <table>
      <tr>
       <th class="left">Note:</th>
      </tr><tr>
       <td class="pre"><xsl:value-of select="/SESSION/RECORDING[1]/BWFXML[1]/VOSGAMES/SESSION_NOTE"/></td>
      </tr>
     </table>
    </td>
   </tr>
  </table>

  <table class="recordings">
   <tr class="header">
    <th>Scene</th>
    <th>Take</th>
    <th>File</th>
    <th>Timecode</th>
    <th>Track 1</th>
    <th>Track 2</th>
    <th>Track 3</th>
    <th>Track 4</th>
    <th>Track 5-8</th>
    
   </tr>
   <xsl:for-each select="SESSION/RECORDING">
    <xsl:variable name="i" select="position()"/>
    <xsl:variable name="oddeven" select="substring('evenodd', ($i mod 2) * 4 + 1, 4 - ($i mod 2))"/>
    <tr><xsl:attribute name="class"><xsl:value-of select="$oddeven"/></xsl:attribute>
     <td><xsl:value-of select="BWFXML[1]/SCENE"/></td>
     <td><xsl:value-of select="BWFXML[1]/TAKE"/></td>
     <td><xsl:value-of select="BWFXML[1]/FILE_SET/FILENAME"/></td>
     <td><xsl:value-of select="BWFXML[1]/SPEED/TIMESTAMP_TEXT"/></td>
     
      <xsl:if test="BWFXML[1]/TRACK_LIST/TRACK_COUNT !=''">
     
      <xsl:for-each select="BWFXML[1]/TRACK_LIST/TRACK">
       <td class="pre"><xsl:value-of select="NAME"/></td>
      </xsl:for-each>
     
    </xsl:if>
    </tr>

    <xsl:if test="BWFXML[1]/NOTE != ''">
     <tr><xsl:attribute name="class"><xsl:value-of select="$oddeven"/></xsl:attribute>
      <th class="alert">note:</th>
      <td colspan="5"><xsl:value-of select="BWFXML[1]/NOTE"/></td>
     </tr>
    </xsl:if>
    
   </xsl:for-each>
  </table>

 </body>
 </html>
</xsl:template>
</xsl:stylesheet>
