summaryrefslogtreecommitdiff
path: root/unclutter/hacker-news.xsl
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-28 05:03:26 +0300
committerdefanor <defanor@uberspace.net>2017-12-28 06:39:17 +0300
commitb11b05385b5615aaf08bd245af53e8df03a193b3 (patch)
tree99304984295784f70f8f4c3e3cbc8488bf16e0a6 /unclutter/hacker-news.xsl
parentc27c14e866dfb4a3c6c85393ffd0522933c67651 (diff)
Install and enable a few uncluttering XSLTs by default
Diffstat (limited to 'unclutter/hacker-news.xsl')
-rw-r--r--unclutter/hacker-news.xsl33
1 files changed, 33 insertions, 0 deletions
diff --git a/unclutter/hacker-news.xsl b/unclutter/hacker-news.xsl
new file mode 100644
index 0000000..0f8c352
--- /dev/null
+++ b/unclutter/hacker-news.xsl
@@ -0,0 +1,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>