<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:variable name="xGoatImg">../img/xGoat/</xsl:variable>
<!-- Affichage des drapeaux départ / arrivée -->
<xsl:template name="affDepArr">
<xsl:param name="nbStep" />
<xsl:param name="count" />
<xsl:if test="$nbStep = 1">
<img>
<xsl:attribute name="src">
<xsl:value-of select="$xGoatImg"/>depart.png
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="//XSL_LABELS/XGOAT/START/*[name()=$lang]"/>
</xsl:attribute>
</img>
</xsl:if>
<xsl:if test="$nbStep = $count">
<img>
<xsl:attribute name="src">
<xsl:value-of select="$xGoatImg"/>arrivee.png
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="//XSL_LABELS/XGOAT/ARRIVAL/*[name()=$lang]"/>
</xsl:attribute>
</img>
</xsl:if>
</xsl:template>
<!-- Affichage des modes de transport pour les parties isochrones -->
<xsl:template name="affIso">
<xsl:param name="iso" />
<xsl:param name="affLabel" />
<xsl:choose>
<xsl:when test="$iso = 'FOOT' or $iso = 'WALK'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">MARCHE</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$iso = 'ROUTE' or $iso = 'PRIVATE_VEHICLE'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">VOITURE</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$iso = 'TAD' or $iso = 'TOD'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">TAD</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$iso = 'BICYCLEVLS'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">VELOSERVICE</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$iso = 'BIKE' or $iso = 'BICYCLE'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">VELO</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$iso = 'CAR_POOL'">
<xsl:call-template name="affMode">
<xsl:with-param name="mode">CAR_POOL</xsl:with-param>
<xsl:with-param name="affLabel" select="$affLabel" />
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- Affichage des modes de transport -->
<xsl:template name="affMode">
<xsl:param name="mode" />
<xsl:param name="affLabel" />
<xsl:variable name="labelMode" select="concat('MODE_', $mode)"/>
<xsl:if test="$affLabel = ''">
<span>
<img>
<xsl:attribute name="src">
<xsl:value-of select="$xGoatImg"/><xsl:value-of select="$mode" />.png
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
</xsl:attribute>
</img>
</span>
</xsl:if>
<xsl:if test="$affLabel != ''">
<img>
<xsl:attribute name="src">
<xsl:value-of select="$xGoatImg"/><xsl:value-of select="$mode" />.png
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
</xsl:attribute>
</img>
<xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
</xsl:if>
</xsl:template>
<!-- Affichage des heures -->
<xsl:template name="affHour">
<xsl:param name="hour" />
<xsl:value-of select="substring(substring-before($hour, ':'), string-length(substring-before($hour, ':'))-1)"/>
<abbr>
<xsl:attribute name="title">
<xsl:value-of select="//XSL_LABELS/*/HOUR/*[name()=$lang]" />
</xsl:attribute>h
</abbr>
<xsl:value-of select="substring(substring-after($hour, ':'), 1, 2)"/>
</xsl:template>
<!-- Affichage des durees -->
<xsl:template name="affDuration">
<xsl:param name="duration" />
<xsl:variable name="hour">
<xsl:if test="contains($duration, 'H')">
<xsl:value-of select="substring-after(substring-before($duration, 'H'), 'PT')"/>
</xsl:if>
<xsl:if test="not(contains($duration, 'H'))">0</xsl:if>
</xsl:variable>
<xsl:variable name="minute">
<xsl:if test="contains($duration, 'H') and not(contains($duration, 'M'))">
0
</xsl:if>
<xsl:if test="contains($duration, 'H') and contains($duration, 'M')">
<xsl:value-of select="substring-before(substring-after($duration, 'H'), 'M')"/>
</xsl:if>
<xsl:if test="not(contains($duration, 'H'))">
<xsl:value-of select="substring-before(substring-after($duration, 'PT'), 'M')"/>
</xsl:if>
<xsl:if test="contains($duration, 'PT') and contains($duration, 'S')">
<xsl:value-of select="substring-before(substring-after($duration, 'PT'), 'S')"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="time">
<xsl:value-of select="(number($hour) * 60) + number($minute)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="(number($time) <= 1)">
<xsl:value-of select="//XSL_LABELS/*/LESS_THAN_MINUTE/*[name()=$lang]" />
</xsl:when>
<xsl:when test="(number($time) < 60)">
<xsl:value-of select="$time"/>
<abbr>
<xsl:attribute name="title">
<xsl:value-of select="//XSL_LABELS/*/MINUTES/*[name()=$lang]" />
</xsl:attribute>min
</abbr>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor(($time) div 60)"/>
<abbr>
<xsl:attribute name="title">
<xsl:value-of select="//XSL_LABELS/*/HOUR/*[name()=$lang]" />
</xsl:attribute>h
</abbr>
<xsl:if test="(($time) mod 60) < 10">0</xsl:if>
<xsl:value-of select="($time) mod 60"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Affichage des lignes -->
<xsl:template name="affLine">
<xsl:param name="name"/>
<xsl:param name="number"/>
<xsl:param name="picto" />
<xsl:param name="operatorId" />
<xsl:param name="link" />
<xsl:choose>
<xsl:when test="$picto != ''">
<img>
<xsl:attribute name="src">
<xsl:value-of select="$picto"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$number"/>
</xsl:attribute>
</img>
</xsl:when>
<xsl:when test="$number != '' and $picto = ''">
<span>
<xsl:attribute name="class">
pictoLine pictoOp<xsl:value-of select="$operatorId"/>
</xsl:attribute>
<xsl:value-of select="$number"/>
</span>
</xsl:when>
</xsl:choose>
  
<xsl:choose>
<xsl:when test="$link != ''">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$link"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:value-of select="$name"/>
</a>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:value-of select="$name"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--Affichage des points sur la carte-->
<xsl:template name="LinkCarto">
<xsl:param name="LinkTitle"/>
<xsl:param name="X"/>
<xsl:param name="Y"/>
<span class="linkCarto">
<a onclick="javascript:ZoomByLatLon('{$X}','{$Y}'),runSynthese();" href="#gmap">
<xsl:attribute name="title">
<xsl:value-of select="$LinkTitle" />
</xsl:attribute>
<xsl:value-of select="$LinkTitle" />
</a>
</span>
</xsl:template>
<!--Affichage des points sur la carte-->
<xsl:template name="LinkCartoID">
<xsl:param name="LinkTitle"/>
<xsl:param name="ID"/>
<span class="linkCarto">
<a onclick="javascript:ZoomByPoint('{$ID}','','','',''),runSynthese();" href="#gmap">
<xsl:attribute name="title">
<xsl:value-of select="$LinkTitle" />
</xsl:attribute>
<xsl:value-of select="$LinkTitle" />
</a>
</span>
</xsl:template>
</xsl:stylesheet>