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 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 's on now?')">
28 <xsl:text>channels-whats-on-now</xsl:text>
30 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 's on?')">
31 <xsl:text>channels-whats-on</xsl:text>
33 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Channels'] and contains(text(), 'Favorites')">
34 <xsl:text>channels-favorites</xsl:text>
37 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 's on?')">
38 <xsl:text>shows-whats-on</xsl:text>
40 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Search a show')">
41 <xsl:text>shows-search</xsl:text>
43 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Favorites')">
44 <xsl:text>shows-favorites</xsl:text>
46 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Favorite Shows'] and contains(text(), 'Add a favorite')">
47 <xsl:text>shows-add-favorite</xsl:text>
50 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Movies'] and contains(text(), 's on?')">
51 <xsl:text>movies-whats-on</xsl:text>
55 <xsl:when test="preceding::xhtml:h2[position() = 1 and text() = 'Sports'] and contains(text(), 's on?')">
56 <xsl:text>sports-whats-on</xsl:text>
59 <xsl:when test="contains(text(), 'Logout')">
60 <xsl:text>logout</xsl:text>
62 <xsl:when test="contains(text(), 'Manual')">
63 <xsl:text>manual-recording</xsl:text>
65 <xsl:when test="contains(text(), 'View')">
66 <xsl:text>view-recordings</xsl:text>
70 <xsl:value-of select="text()"/>
74 <xsl:element name="action">
75 <xsl:attribute name="name"><xsl:value-of select="$type"/></xsl:attribute>
76 <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
77 <xsl:attribute name="reference"><xsl:value-of select="@href"/></xsl:attribute>