6b5070c43425a4a2d4b2cba6a0a3aceb7db61023
[utils] / crawler / kiss / src / main / resources / channel-right-now-graphic.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3   xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">
4
5   <xsl:output method="xml"/>
6   <xsl:strip-space elements="xhtml:a"/>
7
8   <xsl:include href="utilities.xsl"/>
9
10   <!-- =====================================================
11     Copying template.
12     ===================================================== -->
13   <xsl:template match="@*|node()" mode="copy">
14     <xsl:copy>
15       <xsl:apply-templates select="@*|node()" mode="copy"/>
16     </xsl:copy>
17   </xsl:template>
18
19   <xsl:template match="/">
20     <xsl:element name="channel-right-now">
21       <xsl:apply-templates
22         select="//xhtml:table[3]//xhtml:tr[xhtml:td[not(contains(@class, 'listCell'))]]"/>
23     </xsl:element>
24   </xsl:template>
25
26   <xsl:template match="xhtml:tr">
27     <xsl:element name="action">
28       <xsl:attribute name="name">
29         <xsl:call-template name="string-replace">
30           <xsl:with-param name="src" select="xhtml:td[3]//xhtml:a"/>
31           <xsl:with-param name="from" select="$newline"/>
32           <xsl:with-param name="to" select="''"/>
33         </xsl:call-template>
34       </xsl:attribute>
35       <xsl:attribute name="type">
36         <xsl:text>program-info</xsl:text>
37       </xsl:attribute>
38       <xsl:attribute name="reference">
39         <xsl:value-of select="xhtml:td[3]//xhtml:a/@href"/>
40       </xsl:attribute>
41       <xsl:element name="time">
42         <xsl:call-template name="string-replace">
43           <xsl:with-param name="src" select="xhtml:td[1]"/>
44           <xsl:with-param name="from" select="$newline"/>
45           <xsl:with-param name="to" select="''"/>
46         </xsl:call-template>
47       </xsl:element>
48       <xsl:apply-templates select=".//xhtml:script"/>
49     </xsl:element>
50     <xsl:text>
51       
52     </xsl:text>
53   </xsl:template>
54
55   <xsl:template match="xhtml:script">
56     <xsl:variable name="script">
57       <xsl:value-of select="."/>
58     </xsl:variable>
59     <xsl:variable name="description">
60       <xsl:value-of
61         select="substring-before(substring-after($script, '&lt;br&gt;'), '&quot;]')"/>
62     </xsl:variable>
63     <description>
64       <xsl:value-of select="$description"/>
65     </description>
66
67   </xsl:template>
68
69 </xsl:stylesheet>