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"
6 <xsl:output method="xml"/>
7 <xsl:strip-space elements="*"/>
9 <!-- =====================================================
11 ===================================================== -->
12 <xsl:template match="@*|node()" mode="copy">
14 <xsl:apply-templates select="@*|node()" mode="copy"/>
18 <xsl:template match="/">
19 <xsl:element name="login">
20 <xsl:apply-templates select="//xhtml:a"/>
24 <xsl:template match="xhtml:a">
25 <xsl:variable name="type">
27 <!-- Everything in the Favorite Channels section -->
28 <xsl:when test="preceding::node()[contains(text(), 'Favorite') and
31 and following::node()[contains(text(), 'Favorite') and
32 contains(text(), 'Shows')]">
35 <xsl:when test="contains(text(),
37 <xsl:text>channels-whats-on-now</xsl:text>
39 <xsl:when test="contains(text(), 's on?')">
40 <xsl:text>channels-whats-on</xsl:text>
42 <xsl:when test="contains(text(), 'Favorites')">
43 <xsl:text>channels-favorites</xsl:text>
48 <!-- Everything in the Favorite Shows section -->
49 <xsl:when test="preceding::node()[contains(text(), 'Favorite') and
52 and following::node()[contains(text(), 'Movies')]">
54 <xsl:when test="contains(text(), 's on?')">
55 <xsl:text>shows-whats-on</xsl:text>
57 <xsl:when test="contains(text(), 'Search a show')">
58 <xsl:text>shows-search</xsl:text>
60 <xsl:when test="contains(text(), 'Favorites')">
61 <xsl:text>shows-favorites</xsl:text>
63 <xsl:when test="contains(text(), 'Add a favorite')">
64 <xsl:text>shows-add-favorite</xsl:text>
69 <!-- The Movies section -->
70 <xsl:when test="preceding::node()[contains(text(), 'Movies')]
71 and following::node()[contains(text(), 'Sports')]
72 and contains(text(), 's on?')">
73 <xsl:text>movies-whats-on</xsl:text>
76 <!-- Everything in the sports section -->
78 <xsl:when test="preceding::node()[contains(text(), 'Sports')]
79 and contains(text(), 's on?')">
80 <xsl:text>sports-whats-on</xsl:text>
83 <xsl:when test="contains(text(), 'Logout')">
84 <xsl:text>logout</xsl:text>
86 <xsl:when test="contains(text(), 'Manual')">
87 <xsl:text>manual-recording</xsl:text>
89 <xsl:when test="contains(text(), 'View')">
90 <xsl:text>view-recordings</xsl:text>
93 <xsl:text>unknown</xsl:text>
94 <xsl:value-of select="text()"/>
98 <xsl:element name="action">
99 <xsl:attribute name="name"><xsl:value-of select="$type"/></xsl:attribute>
100 <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
101 <xsl:attribute name="reference"><xsl:value-of select="@href"/></xsl:attribute>