summaryrefslogtreecommitdiff
path: root/templates/katsomo.fi/video.xsl
blob: 484e464756b80006b0efdbbbe76a3f788c9afe04 (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
<?xml version="1.0" encoding="UTF-8"?>

<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="title">katsomo_video</xsl:param>
<xsl:param name="videopage"/>

<xsl:template name="mediaurl">
  <xsl:param name="title"/>
  <xsl:param name="videopage"/>

  <xsl:variable name="absoluteurl">
    <xsl:choose>
      <xsl:when test="contains($videopage, 'www.katsomo.fi')">
	<xsl:value-of select="$videopage"/>
      </xsl:when>
      <xsl:otherwise>
	<xsl:value-of select="concat('http://www.katsomo.fi', $videopage)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <mediaurl>
    <title><xsl:value-of select="$title"/></title>
    <url priority="50">
      <xsl:if test="$videopage">wvt:///bin/katsomo-dl?contenttype=video/x-flv&amp;arg=<xsl:value-of select="str:encode-uri($absoluteurl, true())"/></xsl:if>
    </url>
  </mediaurl>
</xsl:template>

<xsl:template match="/">
  <xsl:call-template name="mediaurl">
    <xsl:with-param name="title" select="$title"/>
    <xsl:with-param name="videopage" select="$videopage"/>
  </xsl:call-template>
</xsl:template>

</xsl:stylesheet>