<?xml version="1.0"?>

<!--
	Author: Mael Guillemot
	File: anvil2html.xsl
	Date: May 2004
	Purpose: Convert from ANVIL XML annotations 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>
        <TITLE>Meeting Index </TITLE>

<link rel="stylesheet" href="http://mmm.idiap.ch/ferret.css" type="text/css"/>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"/>

</HEAD>

	<body>

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


		<xsl:apply-templates select="/annotation/head">
		</xsl:apply-templates>
	<hr></hr>
		<xsl:apply-templates select="/annotation/body">
		</xsl:apply-templates>
	</body>
</html>
</xsl:template>



<xsl:template match="annotation/head">
</xsl:template>


<xsl:template match="annotation/body">
		<xsl:apply-templates select="track">
		</xsl:apply-templates>
</xsl:template>



<xsl:template match="track">

<h2><xsl:value-of select="@name"/></h2>
		<xsl:apply-templates select="el">
		</xsl:apply-templates>
</xsl:template>











<xsl:template match="el">
<!--
<a>
<xsl:attribute name="name"><xsl:value-of select="@start"/></xsl:attribute>
</a>
-->

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

<xsl:variable name="floorsec"><xsl:value-of select='floor(@start)'/></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(@end)'/></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>

<font size="-1"><font color="gray">

[
<xsl:if test="$sec &lt; '10'">
<xsl:variable name="newsec"><xsl:value-of select="concat('0',$sec )"/></xsl:variable>
<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @start, $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> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @start, $scrollTrue)"/></xsl:attribute><xsl:value-of select="$floormin"/>:<xsl:value-of select="$newsec"/> </a>
</xsl:if>
] 
 </font></font>
           
      <a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @start, $scrollTrue)"/></xsl:attribute><xsl:apply-templates/></a>
                
 <font size="-1"><font color="gray">
 
<xsl:text> [</xsl:text>
                       
<xsl:if test="$endsec &lt; '10'">
<xsl:variable name="newendsec"><xsl:value-of select="concat('0',$endsec )"/></xsl:variable>
<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @end, $scrollTrue)"/></xsl:attribute><xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$newendsec"/> </a>
</xsl:if>

<xsl:if test="$endsec &gt; '9'">
<xsl:variable name="newendsec"><xsl:value-of select="$endsec"/></xsl:variable>
<a> <xsl:attribute name="href">#stay</xsl:attribute> <xsl:attribute name="onclick"><xsl:value-of select="concat($onClickPlayFrom, @end, $scrollTrue)"/></xsl:attribute><xsl:value-of select="$endfloormin"/>:<xsl:value-of select="$newendsec"/> </a> 
</xsl:if>

] 
                        </font></font>


<br></br>
</xsl:template>



<xsl:template match="attribute">

<xsl:choose>

<xsl:when test="@name='Sensor'">
</xsl:when>

<xsl:when test="@name='Emotion'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Position'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Activity'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Physicalstate'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Interactivity'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Meeting activity'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:when test="@name='Meetingaction'">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:when>

<xsl:otherwise>
        <xsl:value-of select="@name"/><xsl:text>: </xsl:text>
	<xsl:value-of select="."/>
	<xsl:text>, </xsl:text>
</xsl:otherwise>
</xsl:choose>


</xsl:template>


<xsl:template match="comment">
comment:
<xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>

