1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
3 xmlns:xhtml="http://www.w3.org/1999/xhtml"
\r
6 <xsl:output method="xml"/>
\r
7 <xsl:strip-space elements="*"/>
\r
9 <!-- =====================================================
\r
11 ===================================================== -->
\r
12 <xsl:template match="@*|node()" mode="copy">
\r
14 <xsl:apply-templates select="@*|node()" mode="copy"/>
\r
18 <xsl:template match="/">
\r
19 <xsl:element name="login">
\r
20 <xsl:apply-templates select="//xhtml:table[@class = 'tvstart']"/>
\r
24 <xsl:template match="xhtml:table">
\r
25 <action type="channels-whats-on-now" name="channels-whats-on-now" reference="{xhtml:tr[3]/xhtml:td[1]//@href}"/>
\r
27 <action type="channels-whats-on" name="channels-whats-on" reference="{xhtml:tr[5]/xhtml:td[1]//@href}"/>
\r
29 <action type="channels-favorites" name="channels-favorites" reference="{xhtml:tr[7]/xhtml:td[1]//@href}"/>
\r
31 <action type="shows-whats-on" name="shows-whats-on" reference="{xhtml:tr[3]/xhtml:td[3]//@href}"/>
\r
33 <action type="shows-search" name="shows-search" reference="{xhtml:tr[5]/xhtml:td[3]//@href}"/>
\r
35 <action type="shows-favorites" name="shows-favorites" reference="{xhtml:tr[7]/xhtml:td[3]//@href}"/>
\r
37 <action type="shows-add-favorite" name="shows-add-favorite" reference="{xhtml:tr[9]/xhtml:td[3]//@href}"/>
\r
39 <action type="movies-whats-on" name="movies-whats-on" reference="{xhtml:tr[3]/xhtml:td[5]//@href}"/>
\r
41 <action type="sports-whats-on" name="sports-whats-on" reference="{xhtml:tr[9]/xhtml:td[5]//@href}"/>
\r
46 <xsl:template match="xhtml:a">
\r
47 <xsl:variable name="type">
\r
49 <!-- Everything in the Favorite Channels section -->
\r
50 <xsl:when test="preceding::node()[contains(text(), 'Favorite') and
\r
53 and following::node()[contains(text(), 'Favorite') and
\r
54 contains(text(), 'Shows')]">
\r
57 <xsl:when test="contains(text(),
\r
59 <xsl:text>channels-whats-on-now</xsl:text>
\r
61 <xsl:when test="contains(text(), 's on?')">
\r
62 <xsl:text>channels-whats-on</xsl:text>
\r
64 <xsl:when test="contains(text(), 'Favorites')">
\r
65 <xsl:text>channels-favorites</xsl:text>
\r
68 </favorite-channels>
\r
71 <!-- Everything in the Favorite Shows section -->
\r
72 <xsl:when test="preceding::node()[contains(text(), 'Favorite') and
\r
75 and following::node()[contains(text(), 'Movies')]">
\r
77 <xsl:when test="contains(text(), 's on?')">
\r
78 <xsl:text>shows-whats-on</xsl:text>
\r
80 <xsl:when test="contains(text(), 'Search a show')">
\r
81 <xsl:text>shows-search</xsl:text>
\r
83 <xsl:when test="contains(text(), 'Favorites')">
\r
84 <xsl:text>shows-favorites</xsl:text>
\r
86 <xsl:when test="contains(text(), 'Add a favorite')">
\r
87 <xsl:text>shows-add-favorite</xsl:text>
\r
92 <!-- The Movies section -->
\r
93 <xsl:when test="preceding::node()[contains(text(), 'Movies')]
\r
94 and following::node()[contains(text(), 'Sports')]
\r
95 and contains(text(), 's on?')">
\r
96 <xsl:text>movies-whats-on</xsl:text>
\r
99 <!-- Everything in the sports section -->
\r
101 <xsl:when test="preceding::node()[contains(text(), 'Sports')]
\r
102 and contains(text(), 's on?')">
\r
103 <xsl:text>sports-whats-on</xsl:text>
\r
106 <xsl:when test="contains(text(), 'Logout')">
\r
107 <xsl:text>logout</xsl:text>
\r
109 <xsl:when test="contains(text(), 'Manual')">
\r
110 <xsl:text>manual-recording</xsl:text>
\r
112 <xsl:when test="contains(text(), 'View')">
\r
113 <xsl:text>view-recordings</xsl:text>
\r
116 <xsl:text>unknown</xsl:text>
\r
117 <xsl:value-of select="text()"/>
\r
121 <xsl:element name="action">
\r
122 <xsl:attribute name="name"><xsl:value-of select="$type"/></xsl:attribute>
\r
123 <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
\r
124 <xsl:attribute name="reference"><xsl:value-of select="@href"/></xsl:attribute>
\r