Skip to content

Commit

Permalink
Added xslt for RSS.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Sep 25, 2023
1 parent b85df0b commit af0f709
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _include/views/rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

echo '<?xml version="1.0" encoding="utf-8"?>'."\n".
'<?xml-stylesheet href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"?>'."\n";
'<?xml-stylesheet href="'. S2_PATH .'/_styles/rss.xslt' .'" type="text/xsl"?>'."\n";

?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
Expand Down
1 change: 1 addition & 0 deletions _styles/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*
!zeta
!rss.xslt
41 changes: 41 additions & 0 deletions _styles/rss.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="rss/channel/title" /></title>
<style type="text/css">
a {
color: #56d;
text-decoration-thickness: 1px;
text-decoration-color: rgba(85, 102, 221, 0.5);
}
body {
max-width: 720px;
font: 16px/1.5 sans-serif;
margin: 0 auto;
}
h1, h2, h3 {
margin: 1em 0 0.25em;
}
p {
margin: 0 0 0.75em;
}
</style>
</head>
<body>
<h1>
<a href="{rss/channel/link}">
<xsl:value-of select="rss/channel/title" />
</a>
</h1>
<xsl:for-each select="rss/channel/item">
<div class="item">
<h2><a href="{link}"><xsl:value-of select="title" /></a></h2>
<div><xsl:value-of select="description" disable-output-escaping="yes" /></div>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

0 comments on commit af0f709

Please sign in to comment.