rsrsss/style.xsl

83 lines
2.7 KiB
XML

<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/">
<xsl:output method="html" doctype-system="about:legacy-compat" />
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="/rss/channel/title" /></title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="channel">
<a href="{image/link/text()}" target="_blank" style="float: right">
<img src="{image/url/text()}" alt="{image/title/text()}" title="{image/description/text()}" />
</a>
<h1><xsl:value-of select="title" /></h1>
<p><xsl:value-of select="description" /></p>
<xsl:apply-templates select="item" />
<xsl:if test="creativeCommons:license">
<p>
<a href="{creativeCommons:license/text()}" target="_blank">
<img
src="{concat('https://licensebuttons.net/l/', substring-after(creativeCommons:license, 'licenses/'), '88x31.png')}"
alt="{copyright/text()}"
/>
</a>
</p>
</xsl:if>
<xsl:if test="admin:errorReportsTo">
<p><a href="{admin:errorReportsTo/@rdf:resource}">Report errors with this feed</a></p>
</xsl:if>
</xsl:template>
<xsl:template match="item">
<article>
<xsl:if test="title">
<h2><xsl:value-of select="title" /></h2>
</xsl:if>
<xsl:if test="pubDate or link or category">
<p>
<xsl:if test="pubDate">
<span class="timestamp"><xsl:value-of select="pubDate" /></span>
</xsl:if>
<xsl:if test="pubDate and (category or link)">
<xsl:text> &#8212; </xsl:text>
</xsl:if>
<xsl:for-each select="category">
<span class="category"><xsl:value-of select="." /></span>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
<xsl:if test="category and link">
<xsl:text> &#8212; </xsl:text>
</xsl:if>
<xsl:if test="link">
<a href="{link}" target="_blank"><xsl:value-of select="link" /></a>
</xsl:if>
</p>
</xsl:if>
<xsl:if test="description">
<xsl:value-of select="description" disable-output-escaping="yes" />
</xsl:if>
</article>
</xsl:template>
</xsl:stylesheet>