summaryrefslogtreecommitdiffstats
path: root/.config/pancake/unclutter/hacker-news.xsl
blob: 0f8c352487111e4a7c953b64c37d8bbff983c785 (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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" indent="yes"/>
  <xsl:template match="/">
    <html>
      <body>
        Hacker News
        <xsl:for-each select="//td[@class='title' or @class='subtext']">
          <xsl:choose>
            <xsl:when test="@class = 'title'">
              <xsl:variable name="uri" select="a/@href"/>
              <xsl:if test="$uri!=''">
                <br />
                <br />
                <a href="{$uri}" >
                  <xsl:value-of select="a" />
                </a>
              </xsl:if>
            </xsl:when>
            <xsl:when test="@class = 'subtext'">
              <br/>
              <xsl:value-of select="span[@class='age']" />
              |
              <a href="{a[last()]/@href}">
                <xsl:value-of select="a[last()]" />
              </a>
            </xsl:when>
          </xsl:choose>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>