summaryrefslogtreecommitdiff
path: root/templates/katsomo.fi/description.xsl
blob: c45d174b0ec12a283b8c31fbc1f23d297ff101a1 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:str="http://exslt.org/strings"
  exclude-result-prefixes="str">

<xsl:param name="docurl"/>
<xsl:param name="live"/>

<xsl:template match="/">
<xsl:variable name="episodetitle">
  <xsl:choose>
    <xsl:when test="contains(/html/head/meta[@name='title']/@content, ' - Katsomo')">
      <xsl:value-of select="normalize-space(substring-before(/html/head/meta[@name='title']/@content, ' - Katsomo'))"/>
    </xsl:when>
    <xsl:when test="contains(/html/head/meta[@name='title']/@content, ' - MTV3 Katsomo')">
      <xsl:value-of select="normalize-space(substring-before(/html/head/meta[@name='title']/@content, ' - MTV3 Katsomo'))"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="normalize-space(/html/head/meta[@name='title']/@content)"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:variable name="title">
  <xsl:choose>
    <xsl:when test="normalize-space(id('program_content')/h1) = $episodetitle">
      <xsl:value-of select="$episodetitle"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="normalize-space(concat(id('program_content')/h1, ': ', $episodetitle))"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<wvmenu>
  <title><xsl:value-of select="$title"/></title>

  <textarea>
    <label><xsl:value-of select="/html/head/meta[@name='description']/@content"/></label>
  </textarea>

  <xsl:choose>
    <xsl:when test="$live">
      <textarea>
	<label><xsl:value-of select="$live"/></label>
      </textarea>
    </xsl:when>

    <xsl:when test="$docurl">
      <link>
	<label>Download this video</label>
	<stream>wvt:///katsomo.fi/video.xsl?param=videopage,<xsl:value-of select="str:encode-uri($docurl, true())"/>&amp;param=title,<xsl:value-of select="str:encode-uri($title, true())"/></stream>
      </link>
    </xsl:when>
  </xsl:choose>

</wvmenu>
</xsl:template>

</xsl:stylesheet>