Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: XML  |  size: 10.30 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
  2.  
  3.     <xsl:variable name="xGoatImg">../img/xGoat/</xsl:variable>
  4.  
  5.     <!-- Affichage des drapeaux départ / arrivée -->
  6.     <xsl:template name="affDepArr">
  7.         <xsl:param name="nbStep" />
  8.         <xsl:param name="count" />
  9.         <xsl:if test="$nbStep = 1">
  10.             <img>
  11.                 <xsl:attribute name="src">
  12.                     <xsl:value-of select="$xGoatImg"/>depart.png
  13.                 </xsl:attribute>
  14.                 <xsl:attribute name="alt">
  15.                     <xsl:value-of select="//XSL_LABELS/XGOAT/START/*[name()=$lang]"/>
  16.                 </xsl:attribute>
  17.             </img>
  18.         </xsl:if>
  19.         <xsl:if test="$nbStep = $count">
  20.             <img>
  21.                 <xsl:attribute name="src">
  22.                     <xsl:value-of select="$xGoatImg"/>arrivee.png
  23.                 </xsl:attribute>
  24.                 <xsl:attribute name="alt">
  25.                     <xsl:value-of select="//XSL_LABELS/XGOAT/ARRIVAL/*[name()=$lang]"/>
  26.                 </xsl:attribute>
  27.             </img>
  28.         </xsl:if>
  29.     </xsl:template>
  30.  
  31.     <!-- Affichage des modes de transport pour les parties isochrones -->
  32.     <xsl:template name="affIso">
  33.         <xsl:param name="iso" />
  34.         <xsl:param name="affLabel" />
  35.         <xsl:choose>
  36.             <xsl:when test="$iso = 'FOOT' or $iso = 'WALK'">
  37.                 <xsl:call-template name="affMode">
  38.                     <xsl:with-param name="mode">MARCHE</xsl:with-param>
  39.                     <xsl:with-param name="affLabel" select="$affLabel" />
  40.                 </xsl:call-template>
  41.             </xsl:when>
  42.             <xsl:when test="$iso = 'ROUTE' or $iso = 'PRIVATE_VEHICLE'">
  43.                 <xsl:call-template name="affMode">
  44.                     <xsl:with-param name="mode">VOITURE</xsl:with-param>
  45.                     <xsl:with-param name="affLabel" select="$affLabel" />
  46.                 </xsl:call-template>
  47.             </xsl:when>
  48.             <xsl:when test="$iso = 'TAD' or $iso = 'TOD'">
  49.                 <xsl:call-template name="affMode">
  50.                     <xsl:with-param name="mode">TAD</xsl:with-param>
  51.                     <xsl:with-param name="affLabel" select="$affLabel" />
  52.                 </xsl:call-template>
  53.             </xsl:when>
  54.             <xsl:when test="$iso = 'BICYCLEVLS'">
  55.                 <xsl:call-template name="affMode">
  56.                     <xsl:with-param name="mode">VELOSERVICE</xsl:with-param>
  57.                     <xsl:with-param name="affLabel" select="$affLabel" />
  58.                 </xsl:call-template>
  59.             </xsl:when>
  60.             <xsl:when test="$iso = 'BIKE' or $iso = 'BICYCLE'">
  61.                 <xsl:call-template name="affMode">
  62.                     <xsl:with-param name="mode">VELO</xsl:with-param>
  63.                     <xsl:with-param name="affLabel" select="$affLabel" />
  64.                 </xsl:call-template>
  65.             </xsl:when>
  66.             <xsl:when test="$iso = 'CAR_POOL'">
  67.                 <xsl:call-template name="affMode">
  68.                     <xsl:with-param name="mode">CAR_POOL</xsl:with-param>
  69.                     <xsl:with-param name="affLabel" select="$affLabel" />
  70.                 </xsl:call-template>
  71.             </xsl:when>
  72.         </xsl:choose>
  73.     </xsl:template>
  74.  
  75.     <!-- Affichage des modes de transport -->
  76.     <xsl:template name="affMode">
  77.         <xsl:param name="mode" />
  78.         <xsl:param name="affLabel" />
  79.         <xsl:variable name="labelMode" select="concat('MODE_', $mode)"/>
  80.         <xsl:if test="$affLabel = ''">
  81.             <span>
  82.                 <img>
  83.                     <xsl:attribute name="src">
  84.                         <xsl:value-of select="$xGoatImg"/><xsl:value-of select="$mode" />.png
  85.                     </xsl:attribute>
  86.                     <xsl:attribute name="alt">
  87.                         <xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
  88.                     </xsl:attribute>
  89.                 </img>
  90.             </span>
  91.         </xsl:if>
  92.         <xsl:if test="$affLabel != ''">
  93.             <img>
  94.                 <xsl:attribute name="src">
  95.                     <xsl:value-of select="$xGoatImg"/><xsl:value-of select="$mode" />.png
  96.                 </xsl:attribute>
  97.                 <xsl:attribute name="alt">
  98.                     <xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
  99.                 </xsl:attribute>
  100.             </img>
  101.             <xsl:value-of select="//XSL_LABELS/XGOAT/*[name()=$labelMode]/*[name()=$lang]" />
  102.         </xsl:if>
  103.  
  104.     </xsl:template>
  105.  
  106.     <!-- Affichage des heures -->
  107.     <xsl:template name="affHour">
  108.         <xsl:param name="hour" />
  109.  
  110.         <xsl:value-of select="substring(substring-before($hour, ':'), string-length(substring-before($hour, ':'))-1)"/>
  111.         <abbr>
  112.             <xsl:attribute name="title">
  113.                 <xsl:value-of select="//XSL_LABELS/*/HOUR/*[name()=$lang]" />
  114.             </xsl:attribute>h
  115.         </abbr>
  116.         <xsl:value-of select="substring(substring-after($hour, ':'), 1, 2)"/>
  117.     </xsl:template>
  118.  
  119.     <!-- Affichage des durees -->
  120.     <xsl:template name="affDuration">
  121.         <xsl:param name="duration" />
  122.  
  123.         <xsl:variable name="hour">
  124.             <xsl:if test="contains($duration, 'H')">
  125.                 <xsl:value-of select="substring-after(substring-before($duration, 'H'), 'PT')"/>
  126.             </xsl:if>
  127.             <xsl:if test="not(contains($duration, 'H'))">0</xsl:if>
  128.         </xsl:variable>
  129.  
  130.  
  131.         <xsl:variable name="minute">
  132.            
  133.             <xsl:if test="contains($duration, 'H') and not(contains($duration, 'M'))">
  134.                 0
  135.             </xsl:if>
  136.            
  137.             <xsl:if test="contains($duration, 'H') and contains($duration, 'M')">
  138.                 <xsl:value-of select="substring-before(substring-after($duration, 'H'), 'M')"/>
  139.             </xsl:if>
  140.            
  141.             <xsl:if test="not(contains($duration, 'H'))">
  142.                 <xsl:value-of select="substring-before(substring-after($duration, 'PT'), 'M')"/>
  143.             </xsl:if>
  144.  
  145.             <xsl:if test="contains($duration, 'PT') and contains($duration, 'S')">
  146.                 <xsl:value-of select="substring-before(substring-after($duration, 'PT'), 'S')"/>
  147.             </xsl:if>
  148.            
  149.         </xsl:variable>
  150.  
  151.        
  152.         <xsl:variable name="time">
  153.             <xsl:value-of select="(number($hour) * 60) + number($minute)"/>
  154.         </xsl:variable>
  155.         <xsl:choose>
  156.             <xsl:when test="(number($time) &lt;= 1)">
  157.                 <xsl:value-of select="//XSL_LABELS/*/LESS_THAN_MINUTE/*[name()=$lang]" />
  158.             </xsl:when>
  159.             <xsl:when test="(number($time) &lt; 60)">
  160.                 <xsl:value-of select="$time"/>
  161.                 <abbr>
  162.                     <xsl:attribute name="title">
  163.                         <xsl:value-of select="//XSL_LABELS/*/MINUTES/*[name()=$lang]" />
  164.                     </xsl:attribute>min
  165.                 </abbr>
  166.             </xsl:when>
  167.             <xsl:otherwise>
  168.                 <xsl:value-of select="floor(($time) div 60)"/>
  169.                 <abbr>
  170.                     <xsl:attribute name="title">
  171.                         <xsl:value-of select="//XSL_LABELS/*/HOUR/*[name()=$lang]" />
  172.                     </xsl:attribute>h
  173.                 </abbr>
  174.                 <xsl:if test="(($time) mod 60) &lt; 10">0</xsl:if>
  175.                 <xsl:value-of select="($time) mod 60"/>
  176.             </xsl:otherwise>
  177.         </xsl:choose>
  178.     </xsl:template>
  179.  
  180.     <!-- Affichage des lignes -->
  181.     <xsl:template name="affLine">
  182.         <xsl:param name="name"/>
  183.         <xsl:param name="number"/>
  184.         <xsl:param name="picto" />
  185.         <xsl:param name="operatorId" />
  186.         <xsl:param name="link" />
  187.  
  188.         <xsl:choose>
  189.             <xsl:when test="$picto != ''">
  190.                 <img>
  191.                     <xsl:attribute name="src">
  192.                         <xsl:value-of select="$picto"/>
  193.                     </xsl:attribute>
  194.                     <xsl:attribute name="alt">
  195.                         <xsl:value-of select="$number"/>
  196.                     </xsl:attribute>
  197.                 </img>
  198.             </xsl:when>
  199.             <xsl:when test="$number != '' and $picto = ''">
  200.                 <span>
  201.                     <xsl:attribute name="class">
  202.                         pictoLine pictoOp<xsl:value-of select="$operatorId"/>
  203.                     </xsl:attribute>
  204.                     <xsl:value-of select="$number"/>
  205.                 </span>
  206.             </xsl:when>
  207.         </xsl:choose>
  208.         &#xA0;&#xA0;
  209.         <xsl:choose>
  210.             <xsl:when test="$link != ''">
  211.                 <a>
  212.                     <xsl:attribute name="href">
  213.                         <xsl:value-of select="$link"/>
  214.                     </xsl:attribute>
  215.                     <xsl:attribute name="title">
  216.                         <xsl:value-of select="$name"/>
  217.                     </xsl:attribute>
  218.                     <xsl:value-of select="$name"/>
  219.                 </a>
  220.             </xsl:when>
  221.             <xsl:otherwise>
  222.                 <span>
  223.                     <xsl:value-of select="$name"/>
  224.                 </span>
  225.             </xsl:otherwise>
  226.         </xsl:choose>
  227.     </xsl:template>
  228.  
  229.     <!--Affichage des points sur la carte-->
  230.     <xsl:template name="LinkCarto">
  231.         <xsl:param name="LinkTitle"/>
  232.         <xsl:param name="X"/>
  233.         <xsl:param name="Y"/>
  234.  
  235.         <span class="linkCarto">
  236.             <a onclick="javascript:ZoomByLatLon('{$X}','{$Y}'),runSynthese();" href="#gmap">
  237.                 <xsl:attribute name="title">
  238.                     <xsl:value-of select="$LinkTitle" />
  239.                 </xsl:attribute>
  240.                 <xsl:value-of select="$LinkTitle" />
  241.             </a>
  242.         </span>
  243.     </xsl:template>
  244.  
  245.     <!--Affichage des points sur la carte-->
  246.     <xsl:template name="LinkCartoID">
  247.         <xsl:param name="LinkTitle"/>
  248.         <xsl:param name="ID"/>
  249.         <span class="linkCarto">
  250.             <a onclick="javascript:ZoomByPoint('{$ID}','','','',''),runSynthese();" href="#gmap">
  251.                 <xsl:attribute name="title">
  252.                     <xsl:value-of select="$LinkTitle" />
  253.                 </xsl:attribute>
  254.                 <xsl:value-of select="$LinkTitle" />
  255.             </a>
  256.         </span>
  257.     </xsl:template>
  258.  
  259. </xsl:stylesheet>