|
<?xml version="1.0" encoding="UTF-8"?> |
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
xmlns:atom="http://www.w3.org/2005/Atom" |
|
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" |
|
xmlns:date="http://exslt.org/dates-and-times" |
|
extension-element-prefixes="atom dc itunes date"> |
|
|
|
<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/> |
|
|
|
<xsl:param name="id"></xsl:param> |
|
|
|
<xsl:template match="/"> |
|
<xsl:choose> |
|
<xsl:when test="normalize-space($id)!=''"> |
|
<xsl:apply-templates select="atom:feed/atom:entry[atom:id=$id]" mode="detail"/> |
|
</xsl:when> |
|
<xsl:otherwise> |
|
<xsl:call-template name="atom-list"></xsl:call-template> |
|
</xsl:otherwise> |
|
</xsl:choose> |
|
</xsl:template> |
|
|
|
<xsl:template name="atom-list"> |
|
<xsl:text disable-output-escaping="yes"><!DOCTYPE html> </xsl:text> |
|
<html lang="en-us"> |
|
<head> |
|
<title><xsl:value-of select="atom:feed/atom:title"/></title> |
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> |
|
<style type="text/css"><xsl:call-template name="styles"/></style> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
<header> |
|
<h1><xsl:value-of select="atom:feed/atom:title"/></h1> |
|
</header> |
|
<xsl:apply-templates select="atom:feed/atom:entry" mode="list"/> |
|
</div> |
|
</body> |
|
</html> |
|
</xsl:template> |
|
|
|
<xsl:template match="atom:entry" mode="list"> |
|
<xsl:param name="displayDate"> |
|
<xsl:value-of select="date:month-name(atom:updated)"/> |
|
<xsl:text> </xsl:text> |
|
<xsl:value-of select="date:day-in-month(atom:updated)"/> |
|
<xsl:text>, </xsl:text> |
|
<xsl:value-of select="date:year(atom:updated)"/> |
|
</xsl:param> |
|
<div class="pb-5"> |
|
<h3> |
|
<a href="?id={atom:id}" target="_blank" rel="noopener"> |
|
<xsl:value-of select="atom:title"/> |
|
</a> |
|
</h3> |
|
<small class="meta"> |
|
<xsl:text>Published: </xsl:text> |
|
<xsl:value-of select="$displayDate"/> |
|
</small> |
|
</div> |
|
</xsl:template> |
|
|
|
<xsl:template match="atom:entry" mode="detail"> |
|
<xsl:value-of select="atom:content" disable-output-escaping="yes"/> |
|
</xsl:template> |
|
|
|
<xsl:template name="styles"> |
|
* { box-sizing: border-box; } |
|
img { max-width: 100%; } |
|
body { --gap: 1.4em; margin: 0; font-family: system-ui; line-height: 1.4; } |
|
h1,h2,h3 { margin-block-start: 0; margin-block-end: 0; line-height: 1.2; } |
|
.container { display: grid; gap: var(--gap); max-width: 46rem; width: 95%; margin: 1.4em auto; } |
|
</xsl:template> |
|
|
|
|
|
</xsl:stylesheet> |