<?xml version="1.0"?>

<!--
	Author: Andrei Popescu-Belis modified by Mael Guillemot
	File: sda-to-html.xsl
	Date: 19 May 2003
	Purpose: Convert from the SDA annotation to HTML
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
<xsl:strip-space elements="*"/>



<xsl:template match="/">
<html>

<head>
<style>




  body.transcript 	{ padding:	0% 0% 0% 0%; margin:	0% 0% 0% 0%;}
  table	{ padding:	0% 0% 0% 0%; margin:	0% 0% 0% 0%;}


 A:link { color: black; font-size:10px; font-family: comic Sans MS, Verdana,Helvetica,Arial,sans-serif; text-decoration: none; } 
 A:visited { color: black; font-size:10px; font-family: comic Sans MS, Verdana,Helvetica,Arial,sans-serif; text-decoration: none; }
 A:hover {color: darkorange; font-size:10px; font-family: comic Sans MS, Verdana,Helvetica,Arial,sans-serif; text-decoration: none;}


 td{font-family: comic Sans MS, Verdana,Helvetica,Arial,sans-serif; font-size:10px; color: #000000;} 


a.time{font-family: comic Sans MS, Verdana,Helvetica,Arial,sans-serif; } 







</style>
</head>



	<body class="transcript">


<script type="text/javascript" src="http://mmm.idiap.ch:8180/ferret.js">
</script>



	<table  align="center" BORDER="0" WIDTH="100%" >

		<xsl:apply-templates select="/dialog/channel/utt|/dialog/episodes/episode">
			<xsl:sort select="./@startTime" data-type="number"/>
		</xsl:apply-templates>

	</table>

	<hr></hr>


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







<xsl:template match="utt">

<tr>


<xsl:variable name="floorsec"><xsl:value-of select='floor(@startTime)'/></xsl:variable>
<xsl:variable name="min"><xsl:value-of select="number($floorsec)*0.016666667"/></xsl:variable>
<xsl:variable name="floormin"><xsl:value-of select="floor($min)"/></xsl:variable>
<xsl:variable name="minInSec"><xsl:value-of select="number($floormin)*60"/></xsl:variable>
<xsl:variable name="sec"><xsl:value-of select="number($floorsec)-number($minInSec)"/></xsl:variable>




<xsl:variable name="endfloorsec"><xsl:value-of select='floor(@endTime)'/></xsl:variable>
<xsl:variable name="endmin"><xsl:value-of select="number($endfloorsec)*0.016666667"/></xsl:variable>
<xsl:variable name="endfloormin"><xsl:value-of select="floor($endmin)"/></xsl:variable>
<xsl:variable name="endminInSec"><xsl:value-of select="number($endfloormin)*60"/></xsl:variable>
<xsl:variable name="endsec"><xsl:value-of select="number($endfloorsec)-number($endminInSec)"/></xsl:variable>




<xsl:if test="../@id=0">
<a>
<xsl:attribute name="name"><xsl:value-of select="floor(@startTime)"/></xsl:attribute>
</a>

		
<xsl:variable name="onClickPlayFrom">playFrom2('</xsl:variable>
<xsl:variable name="scrollTrue">', true)</xsl:variable>

<td width="100%"  bgcolor="#8888ff">
 <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>





<xsl:if test="$sec &lt; '10'">
<xsl:variable name="newsec"><xsl:value-of select="concat('0',$sec )"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

<xsl:if test="$sec &gt; '9'">
<xsl:variable name="newsec"><xsl:value-of select="$sec"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>




 

		
			
				<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute><xsl:value-of select="."/> </a>
		
		





			 
			[<xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$endsec"/>]
			
</td>
</xsl:if>







<xsl:if test="../@id=1">
<a>
<xsl:attribute name="name"><xsl:value-of select="floor(@startTime)"/></xsl:attribute>
</a>

		
<xsl:variable name="onClickPlayFrom">playFrom2('</xsl:variable>
<xsl:variable name="scrollTrue">', true)</xsl:variable>

<td width="100%"  bgcolor="#50b050">
 <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>



<xsl:if test="$sec &lt; '10'">
<xsl:variable name="newsec"><xsl:value-of select="concat('0',$sec )"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

<xsl:if test="$sec &gt; '9'">
<xsl:variable name="newsec"><xsl:value-of select="$sec"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

 


		
				<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute><xsl:value-of select="."/> </a>
		





			
			[<xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$endsec"/>]
			
</td>
</xsl:if>







<xsl:if test="../@id=2">
<a>
<xsl:attribute name="name"><xsl:value-of select="floor(@startTime)"/></xsl:attribute>
</a>
		
<xsl:variable name="onClickPlayFrom">playFrom2('</xsl:variable>
<xsl:variable name="scrollTrue">', true)</xsl:variable>

<td width="100%"  bgcolor="#b040b0">
 <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>




<xsl:if test="$sec &lt; '10'">
<xsl:variable name="newsec"><xsl:value-of select="concat('0',$sec )"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

<xsl:if test="$sec &gt; '9'">
<xsl:variable name="newsec"><xsl:value-of select="$sec"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

 


		
				<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute><xsl:value-of select="."/> </a>
		



			
			[<xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$endsec"/>]
			
</td>
</xsl:if>

<xsl:if test="../@id=3">
<a>
<xsl:attribute name="name"><xsl:value-of select="floor(@startTime)"/></xsl:attribute>
</a>

		
<xsl:variable name="onClickPlayFrom">playFrom2('</xsl:variable>
<xsl:variable name="scrollTrue">', true)</xsl:variable>

<td width="100%"  bgcolor="#fdfd01">
 <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>




<xsl:if test="$sec &lt; '10'">
<xsl:variable name="newsec"><xsl:value-of select="concat('0',$sec )"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>

<xsl:if test="$sec &gt; '9'">
<xsl:variable name="newsec"><xsl:value-of select="$sec"/></xsl:variable>
<a class='time'> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/>] </a>
</xsl:if>


 


		
				<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @startTime, $scrollTrue)"/></xsl:attribute><xsl:value-of select="."/></a>
		

			
			[<xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$endsec"/>]			
			 
</td>
</xsl:if>



</tr>





</xsl:template>






<xsl:template match="episode">
	<tr valign="middle">
		<!-- <td></td> -->
		<td bgcolor="777777" width="200">
			<center>
				<font size="+2" color="eeeeee"><xsl:value-of select="@topic"/></font>
				<xsl:if test="@keywords"> (<i>Keywords: <xsl:value-of select="@keywords"/></i>) </xsl:if>
			</center>
		</td>
	</tr>
</xsl:template>

<xsl:template match="Sync">
		
<xsl:variable name="onClickPlayFrom">playFrom2('</xsl:variable>
<xsl:variable name="scrollTrue">', true)</xsl:variable>

 
	<a> <xsl:attribute name="href"><xsl:value-of select="concat('#', @time)"/></xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @time, $scrollTrue)"/></xsl:attribute>[<xsl:value-of select="@time"/>] </a>

 
</xsl:template>





</xsl:stylesheet>

