summaryrefslogtreecommitdiff
path: root/templates/metacafe/description.xsl
blob: 3cb7f2bdd11f14c8771ecb931d25d9a7af273389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:media="http://search.yahoo.com/mrss/">

<!-- Convert $seconds to hours:min:sec format -->
<xsl:template name="pretty-print-seconds">
  <xsl:param name="seconds"/>

  <xsl:variable name="sec" select="$seconds mod 60"/>
  <xsl:variable name="min" select="floor($seconds div 60) mod 60"/>
  <xsl:variable name="hour" select="floor($seconds div 3600)"/>

  <xsl:value-of select="concat($hour, ':', format-number($min, '00'), ':', format-number($sec, '00'))"/>
</xsl:template>

<xsl:template match="/">
<wvmenu>
  <title><xsl:value-of select="/rss/channel/item/title"/></title>

  <textarea>
    <label><xsl:value-of select="/rss/channel/item/media:description"/></label>
  </textarea>

  <textarea>
    <label>Duration: <xsl:call-template name="pretty-print-seconds">
        <xsl:with-param name="seconds">
          <xsl:value-of select="/rss/channel/item/media:content/@duration"/>
        </xsl:with-param>
      </xsl:call-template>
    </label>
  </textarea>

  <textarea>
    <label>Rating: <xsl:value-of select="/rss/channel/item/rank"/></label>
  </textarea>

  <textarea>
    <label>published: <xsl:value-of select="/rss/channel/item/pubDate"/></label>
  </textarea>


</wvmenu>
</xsl:template>

</xsl:stylesheet>