Add XSLT stylesheet for RSS feed

This commit is contained in:
Alex Cabal 2022-06-19 21:11:43 -05:00
parent 30a3dd053f
commit a3d823dd5a
5 changed files with 60 additions and 6 deletions

39
www/rss/style.php Normal file
View file

@ -0,0 +1,39 @@
<?
require_once('Core.php');
header('content-type: application/xslt+xml');
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
?>
<xsl:stylesheet version="3.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" html-version="5.0" encoding="utf-8" indent="true"/>
<xsl:template match="/">
<?= Template::Header(['xmlDeclaration' => false]) ?>
<main>
<h1><xsl:value-of select="substring-after(/rss/channel/title, 'Standard Ebooks - ')"/></h1>
<p><xsl:value-of select="/rss/channel/description"/></p>
<p>This page is an RSS feed. The URL in your address bar (<a ><xsl:attribute name="href"><xsl:value-of select="/rss/channel/atom:link/@href"/></xsl:attribute><xsl:value-of select="/rss/channel/atom:link/@href"/></a>) can be used in any RSS reader.</p>
<ol class="rss">
<xsl:for-each select="/rss/channel/item">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
<ul class="tags">
<xsl:for-each select="category">
<li>
<p><xsl:value-of select="."/></p>
</li>
</xsl:for-each>
</ul>
<p>
<xsl:value-of select="description"/>
</p>
</li>
</xsl:for-each>
</ol>
</main>
<?= Template::Footer() ?>
</xsl:template>
</xsl:stylesheet>