rsrsss/xsl/style.xsl

869 lines
34 KiB
XML

<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:access="http://www.bloglines.com/about/specs/fac-1.0"
xmlns:admin="http://webns.net/mvcb/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
xmlns:cc="http://web.resource.org/cc/"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:geourl="http://geourl.org/rss/module/"
xmlns:icbm="http://postneo.com/icbm"
xmlns:idx="urn:atom-extension:indexing"
xmlns:nhc="https://www.nhc.noaa.gov"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:ss="http://purl.org/rss/1.0/modules/servicestatus/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:webfeeds="http://webfeeds.org/rss/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsi:schemaLocation="
http://postneo.com/icbm ../xsd/icbm.xsd
http://geourl.org/rss/module/ ../xsd/geourl.xsd
https://www.nhc.noaa.gov ../xsd/nhc.xsd
http://purl.org/rss/1.0/modules/servicestatus/ ../xsd/servicestatus.xsd
"
>
<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="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/sprites.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<xsl:if test="/rss/channel/atom:link[@rel='self']/@href">
<link rel="alternate" type="application/rss+xml" href="{/rss/channel/atom:link[@rel='self']/@href}" />
</xsl:if>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<xsl:if test="/rss/channel/admin:generatorAgent/@rdf:resource | /rss/channel/generator">
<meta name="generator" content="{/rss/channel/admin:generatorAgent/@rdf:resource | /rss/channel/generator}" />
</xsl:if>
<xsl:if test="/rss/access:restriction/@relationship = 'deny'">
<meta name="robots" content="noindex,nofollow,noarchive,nosnippet,noimageindex,nocache,none" />
</xsl:if>
<xsl:if test="(/rss/channel/icbm:latitude and /rss/channel/icbm:longitude) or (/rss/channel/geo:lat and /rss/channel/geo:long) or (/rss/channel/geourl:latitude and /rss/channel/geourl:longitude)">
<meta name="ICBM">
<xsl:attribute name="content">
<xsl:choose>
<xsl:when test="/rss/channel/icbm:latitude and /rss/channel/icbm:longitude">
<xsl:value-of select="/rss/channel/icbm:latitude" />
<xsl:text>, </xsl:text>
<xsl:value-of select="/rss/channel/icbm:longitude" />
</xsl:when>
<xsl:when test="/rss/channel/geo:lat and /rss/channel/geo:long">
<xsl:value-of select="/rss/channel/geo:lat" />
<xsl:text>, </xsl:text>
<xsl:value-of select="/rss/channel/geo:long" />
</xsl:when>
<xsl:when test="/rss/channel/geourl:latitude and /rss/channel/geourl:longitude">
<xsl:value-of select="/rss/channel/geourl:latitude" />
<xsl:text>, </xsl:text>
<xsl:value-of select="/rss/channel/geourl:longitude" />
</xsl:when>
</xsl:choose>
</xsl:attribute>
</meta>
</xsl:if>
</head>
<body id="top">
<xsl:apply-templates select="/rss/channel" />
</body>
</html>
</xsl:template>
<xsl:template match="channel">
<header>
<xsl:if test="webfeeds:accentColor">
<xsl:attribute name="style">
<xsl:text>background: #</xsl:text>
<xsl:value-of select="webfeeds:accentColor" />
<xsl:text> linear-gradient(0, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:if test="image">
<a href="{image/link/text()}" class="channel-logo" target="_blank">
<img src="{image/url/text()}" alt="{image/title/text()}" title="{image/description/text()}" />
</a>
</xsl:if>
<hgroup>
<h1><xsl:value-of select="title" /></h1>
<p><xsl:value-of select="description" /></p>
</hgroup>
</header>
<!-- TODO: include Dublin Core stuff -->
<xsl:if test="textInput or pubDate or lastBuildDate or language or (icbm:latitude and icbm:longitude) or (geo:lat and geo:long) or (geourl:latitude and geourl:longitude) or category or rating or generator or admin:generatorAgent or copyright or cc:license or creativeCommons:license or managingEditor or webMaster or admin:errorReportsTo or /rss/access:restriction or /rss/@idx:index or ttl or skipDays/day or skipHours/hour or sy:updatePeriod or sy:updateFrequency or sy:updateBase or cloud or ss:aboutStats or blogChannel:blogRoll or blogChannel:blink or blogChannel:mySubscriptions">
<section>
<xsl:if test="textInput">
<form action="{textInput/link}" class="textinput">
<input type="text" name="{textInput/name}" placeholder="{textInput/description}" title="{textInput/description}" required="required" />
<input type="submit" value="{textInput/title}" />
</form>
</xsl:if>
<details>
<summary>About this feed</summary>
<dl>
<xsl:if test="pubDate">
<dt>Last generated</dt>
<dd><xsl:value-of select="pubDate" /></dd>
</xsl:if>
<xsl:if test="lastBuildDate">
<dt>Last content update</dt>
<dd><xsl:value-of select="lastBuildDate" /></dd>
</xsl:if>
<xsl:if test="language">
<dt>Language</dt>
<dd><xsl:value-of select="language" /></dd>
</xsl:if>
<xsl:if test="icbm:latitude and icbm:longitude">
<dt>ICBM address</dt>
<dd>
<xsl:call-template name="icbm-link" />
</dd>
</xsl:if>
<xsl:if test="geo:lat and geo:long">
<dt>RDF Geo location</dt>
<dd>
<xsl:call-template name="geo-link" />
</dd>
</xsl:if>
<xsl:if test="geourl:latitude and geourl:longitude">
<dt>GeoURL.org location</dt>
<dd>
<xsl:call-template name="geourl-link" />
</dd>
</xsl:if>
<xsl:if test="category">
<dt>
<xsl:choose>
<xsl:when test="count(category) > 1">
<xsl:text>Categories</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Category</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<ul>
<xsl:for-each select="category">
<li>
<xsl:value-of select="." />
<xsl:if test="@domain">
<xsl:text> at </xsl:text>
<a href="{@domain}">
<xsl:value-of select="@domain" />
</a>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</dd>
</xsl:if>
<xsl:if test="rating">
<dt><a href="https://www.w3.org/PICS/" target="_blank" title="Platform for Internet Content Selection">PICS</a> rating</dt>
<dd><xsl:value-of select="rating" /></dd>
</xsl:if>
<xsl:if test="generator | admin:generatorAgent">
<dt>Generator</dt>
<dd>
<xsl:choose>
<xsl:when test="admin:generatorAgent/@rdf:resource">
<a href="{admin:generatorAgent/@rdf:resource}" target="_blank">
<xsl:value-of select="admin:generatorAgent/@rdf:resource" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generator" />
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="copyright">
<dt>Copyright</dt>
<dd><xsl:value-of select="copyright" /></dd>
</xsl:if>
<xsl:if test="cc:license | creativeCommons:license">
<dt>Creative Commons license</dt>
<dd>
<a href="{cc:license/@rdf:resource | creativeCommons:license}" target="_blank">
<xsl:value-of select="cc:license/@rdf:resource | creativeCommons:license" />
</a>
</dd>
</xsl:if>
<!--
HTML5 only allows one <address> tag to note the contact information
for a <main> or <article>, so we use errorReportsTo which is always
an email address, or when not available we fallback on webMaster,
and finally on managingEditor.
-->
<xsl:if test="managingEditor">
<dt>Managing editor</dt>
<dd>
<xsl:choose>
<xsl:when test="webMaster or admin:errorReportsTo">
<xsl:value-of select="managingEditor" />
</xsl:when>
<xsl:otherwise>
<address>
<xsl:value-of select="managingEditor" />
</address>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="webMaster">
<dt>Webmaster</dt>
<xsl:choose>
<xsl:when test="admin:errorReportsTo">
<xsl:value-of select="webMaster" />
</xsl:when>
<xsl:otherwise>
<address>
<xsl:value-of select="webMaster" />
</address>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="admin:errorReportsTo">
<dt>Error reports</dt>
<dd>
<address>
<a href="{admin:errorReportsTo/@rdf:resource}" target="_blank">
<xsl:value-of select="admin:errorReportsTo/@rdf:resource" />
</a>
</address>
</dd>
</xsl:if>
<xsl:if test="webfeeds:partial">
<dt>Partial feed</dt>
<dd>
<xsl:choose>
<xsl:when test="webfeeds:partial/text() = 'true'">
<xsl:text>Yes</xsl:text>
</xsl:when>
<xsl:when test="webfeeds:partial/text() = 'false'">
<xsl:text>No</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Invalid value</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="webfeeds:deprecated">
<dt>Deprecated</dt>
<dd>
<xsl:choose>
<xsl:when test="webfeeds:deprecated/text() = 'true'">
<xsl:text>Yes</xsl:text>
</xsl:when>
<xsl:when test="webfeeds:deprecated/text() = 'false'">
<xsl:text>No</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Invalid value</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="/rss/access:restriction">
<dt><a href="https://web.archive.org/web/20080101062756/http://www.bloglines.com/about/specs/fac-1.0" target="_blank">Feed Access Control</a></dt>
<dd>
<xsl:text>Search engine indexation and feed aggregation is </xsl:text>
<xsl:choose>
<xsl:when test="/rss/access:restriction/@relationship = 'allow'">
<xsl:text>allowed</xsl:text>
</xsl:when>
<xsl:when test="/rss/access:restriction/@relationship = 'deny'">
<xsl:text>denied</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>set to an invalid value</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="/rss/@idx:index">
<dt>Atom indexing extension</dt>
<dd>
<xsl:text>Search engine indexation is </xsl:text>
<xsl:choose>
<xsl:when test="/rss/@idx:index = 'yes'">
<xsl:text>allowed</xsl:text>
</xsl:when>
<xsl:when test="/rss/@idx:index = 'no'">
<xsl:text>denied</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>set to an invalid value</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="ttl">
<dt><abbr title="Time To Live">TTL</abbr> (recommended update interval)</dt>
<dd>
<xsl:if test="ttl >= 10080">
<xsl:value-of select="floor(ttl div 10080)" />
<xsl:text> week</xsl:text>
<xsl:if test="ttl div 10080 >= 2">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="ttl mod 10080 >= 1440">
<xsl:value-of select="floor(ttl mod 10080 div 1440)" />
<xsl:text> day</xsl:text>
<xsl:if test="ttl mod 10080 div 1440 >= 2">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="ttl mod 10080 mod 1440 >= 60">
<xsl:value-of select="floor(ttl mod 10080 mod 1440 div 60)" />
<xsl:text> hour</xsl:text>
<xsl:if test="ttl mod 10080 mod 1440 div 60 >= 2">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="ttl mod 60 > 0">
<xsl:value-of select="ttl mod 60" />
<xsl:text> minute</xsl:text>
<xsl:if test="ttl mod 60 > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:if>
</dd>
</xsl:if>
<xsl:if test="skipDays/day">
<dt>Days where feed updates should be skipped</dt>
<dd>
<xsl:for-each select="skipDays/day">
<xsl:value-of select="." />
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</dd>
</xsl:if>
<xsl:if test="skipHours/hour">
<dt>Hours where feed updates should be skipped</dt>
<dd>
<xsl:for-each select="skipHours/hour">
<xsl:value-of select="." />
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</dd>
</xsl:if>
<xsl:if test="sy:updatePeriod | sy:updateFrequency | sy:updateBase">
<dt><a href="https://web.resource.org/rss/1.0/modules/syndication/" target="_blank">mod_syndication</a> recommended update interval</dt>
<dd>
<xsl:text>Every </xsl:text>
<xsl:if test="sy:updateFrequency > 1">
<xsl:value-of select="sy:updateFrequency" />
<xsl:text> </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="sy:updatePeriod/text() = 'daily' or not(sy:updatePeriod)">
day
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before(sy:updatePeriod, 'ly')" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="number(sy:updateFrequency) > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:if test="sy:updateBase">
<xsl:text>, starting from </xsl:text>
<xsl:value-of select="sy:updateBase" />
</xsl:if>
</dd>
</xsl:if>
<xsl:if test="cloud">
<dt><a href="https://www.rssboard.org/rsscloud-interface" target="_blank">RssCloud</a> interface</dt>
<dd>
<dl>
<xsl:if test="cloud/@domain">
<dt>Domain</dt>
<dd><xsl:value-of select="cloud/@domain" /></dd>
</xsl:if>
<xsl:if test="cloud/@port">
<dt>Port</dt>
<dd><xsl:value-of select="cloud/@port" /></dd>
</xsl:if>
<xsl:if test="cloud/@path">
<dt>Path</dt>
<dd><xsl:value-of select="cloud/@path" /></dd>
</xsl:if>
<xsl:if test="cloud/@protocol">
<dt>Protocol</dt>
<dd><xsl:value-of select="cloud/@protocol" /></dd>
</xsl:if>
<xsl:if test="cloud/@registerProcedure">
<dt>Registration procedure name</dt>
<dd><xsl:value-of select="cloud/@registerProcedure" /></dd>
</xsl:if>
</dl>
</dd>
</xsl:if>
<xsl:if test="ss:aboutStats">
<dt><a href="https://web.resource.org/rss/1.0/modules/servicestatus/" target="_blank">mod_servicestatus</a> statistics description</dt>
<dd>
<a href="{ss:aboutStats}" target="_blank">
<xsl:value-of select="ss:aboutStats" />
</a>
</dd>
</xsl:if>
<xsl:if test="blogChannel:blogRoll">
<dt>Blogroll (OPML)</dt>
<dd>
<a href="{blogChannel:blogRoll}" target="_blank">
<xsl:value-of select="blogChannel:blogRoll" />
</a>
</dd>
</xsl:if>
<xsl:if test="blogChannel:mySubscriptions">
<dt>Author's subscriptions (OPML)</dt>
<dd>
<a href="{blogChannel:mySubscriptions}" target="_blank">
<xsl:value-of select="blogChannel:mySubscriptions" />
</a>
</dd>
</xsl:if>
<xsl:if test="blogChannel:blink">
<dt>
<a href="http://web.archive.org/web/20020925030017/http://diveintomark.org/archives/2002/09/17.html#blink_and_youll_miss_it" target="_blank">B-Link</a>
</dt>
<dd>
<a href="{blogChannel:blink}" target="_blank">B-Link</a>
</dd>
</xsl:if>
</dl>
</details>
<xsl:if test="textInput">
<div class="clearfix"></div>
</xsl:if>
</section>
</xsl:if>
<main>
<xsl:apply-templates select="item" />
</main>
<footer>
<a href="https://validator.w3.org/feed/check.cgi?url={link/text()}" target="_blank">
<img src="img/valid-rss.png" alt="Valid RSS" />
</a>
<xsl:if test="creativeCommons:license">
<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>
</xsl:if>
<xsl:if test="admin:errorReportsTo">
<a href="{admin:errorReportsTo/@rdf:resource}">Report a bug</a>
</xsl:if>
<xsl:if test="blogChannel:blogRoll">
<a href="{blogChannel:blogRoll}" target="_blank">Blogroll (OPML)</a>
</xsl:if>
<xsl:if test="blogChannel:mySubscriptions">
<a href="{blogChannel:mySubscriptions}" target="_blank">Author's subscriptions (OPML)</a>
</xsl:if>
<xsl:if test="blogChannel:blink">
<span>
<a href="{blogChannel:blink}" target="_blank">B-Link</a>
<xsl:text> (</xsl:text>
<a href="http://web.archive.org/web/20020925030017/http://diveintomark.org/archives/2002/09/17.html#blink_and_youll_miss_it" target="_blank">What's this?</a>
<xsl:text>)</xsl:text>
</span>
</xsl:if>
<a href="#top">Back to top</a>
</footer>
<script type="text/javascript" language="javascript" src="js/script.js" />
</xsl:template>
<xsl:template match="item">
<article>
<xsl:if test="guid[@isPermaLink='false']">
<xsl:attribute name="id">
<xsl:value-of select="guid[@isPermaLink='false']" />
</xsl:attribute>
</xsl:if>
<xsl:if test="title or link or pubDate">
<header>
<xsl:if test="title or link">
<hgroup>
<xsl:if test="title">
<h2><xsl:value-of select="title" /></h2>
</xsl:if>
<xsl:if test="link">
<p>
<a href="{link}" target="_blank">
<xsl:value-of select="link" />
</a>
</p>
</xsl:if>
</hgroup>
</xsl:if>
<xsl:if test="pubDate">
<p>
<time><xsl:value-of select="pubDate" /></time>
</p>
</xsl:if>
</header>
</xsl:if>
<div class="unescape">
<xsl:value-of select="description" disable-output-escaping="yes" />
</div>
<xsl:apply-templates select="nhc:Cyclone" />
<xsl:if test="ss:responding or ss:lastChecked or ss:lastSeen or ss:availability or ss:averageResponseTime or ss:statusMessage">
<hr />
<details>
<summary>
<xsl:choose>
<xsl:when test="ss:responding/text() = 'true' or ss:responding/text() = '1'">
<span class="icon-bullet-green" alt="Service is responding" />
</xsl:when>
<xsl:when test="ss:responding/text() = 'false' or ss:responding/text() = '0'">
<span class="icon-bullet-red" alt="Service not responding" />
</xsl:when>
</xsl:choose>
<xsl:text>Service status</xsl:text>
</summary>
<dl>
<xsl:if test="ss:responding">
<dt>Last check result</dt>
<dd>
<xsl:choose>
<xsl:when test="ss:responding/text() = 'true' or ss:responding/text() = '1'">
<xsl:text>Service is responding</xsl:text>
</xsl:when>
<xsl:when test="ss:responding/text() = 'false' or ss:responding/text() = '0'">
<xsl:text>Service is not responding</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Unknown value: </xsl:text>
<xsl:value-of select="ss:responding" />
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
<xsl:if test="ss:lastChecked">
<dt>Last check time</dt>
<dd>
<time>
<xsl:value-of select="ss:lastChecked" />
</time>
</dd>
</xsl:if>
<xsl:if test="ss:lastSeen">
<dt>Last successful check</dt>
<dd>
<time>
<xsl:value-of select="ss:lastSeen" />
</time>
</dd>
</xsl:if>
<xsl:if test="ss:availability">
<dt>Availability</dt>
<dd>
<xsl:value-of select="ss:availability" />
<xsl:text>%</xsl:text>
</dd>
</xsl:if>
<xsl:if test="ss:averageResponseTime">
<dt>Average response time</dt>
<dd>
<time datetime="PT{ss:averageResponseTime}S">
<xsl:value-of select="ss:averageResponseTime" />
<xsl:text> seconds</xsl:text>
</time>
</dd>
</xsl:if>
<xsl:if test="ss:statusMessage">
<dt>Status message</dt>
<dd>
<xsl:value-of select="ss:statusMessage" />
</dd>
</xsl:if>
</dl>
</details>
</xsl:if>
<xsl:if test="guid or comments or slash:comments or category or author or enclosure or source or (icbm:latitude and icbm:longitude) or (geo:lat and geo:long) or (geourl:latitude and geourl:longitude)">
<footer>
<p>
<xsl:if test="guid or comments or slash:comments">
<span class="right">
<xsl:choose>
<xsl:when test="comments">
<a href="{comments}" target="_blank">
<span class="icon-comments" alt="Comments" />
<xsl:if test="slash:comments">
<xsl:value-of select="slash:comments" />
</xsl:if>
</a>
<xsl:text> </xsl:text>
</xsl:when>
<!-- Only the comments count is specified, no link. Weird, but possible -->
<xsl:when test="slash:comments">
<span class="icon-comments" alt="Comments" />
<xsl:value-of select="slash:comments" />
<xsl:text> </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:if test="guid">
<a>
<xsl:attribute name="href">
<xsl:if test="guid[@isPermaLink='false']">
<xsl:text>#</xsl:text>
</xsl:if>
<xsl:value-of select="guid" />
</xsl:attribute>
<span class="icon-guid" alt="Permalink" />
</a>
</xsl:if>
</span>
</xsl:if>
<xsl:if test="category">
<span class="icon-categories" alt="Categories" />
<xsl:for-each select="category">
<xsl:value-of select="." />
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="author">
<xsl:if test="category">
<xsl:text> &#8212; </xsl:text>
</xsl:if>
<span class="icon-author" alt="Author" />
<address>
<xsl:value-of select="author" />
</address>
</xsl:if>
<xsl:if test="enclosure">
<xsl:if test="category or author">
<br />
</xsl:if>
<a href="{enclosure/@url}" target="_blank">
<span class="icon-enclosure" alt="Enclosure" />
<xsl:value-of select="enclosure/@url" />
</a>
<xsl:if test="enclosure/@type or enclosure/@length">
<xsl:text> (</xsl:text>
<xsl:value-of select="enclosure/@type" />
<xsl:if test="enclosure/@length">
<xsl:if test="enclosure/@type">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="enclosure/@length" />
<xsl:text> bytes</xsl:text>
</xsl:if>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="source">
<xsl:if test="category or author or enclosure">
<br />
</xsl:if>
<a href="{source}" target="_blank">
<span class="icon-source" alt="Source" />
<xsl:value-of select="source" />
</a>
</xsl:if>
<xsl:if test="icbm:latitude and icbm:longitude">
<xsl:if test="category or author or enclosure or source">
<br />
</xsl:if>
<xsl:call-template name="icbm-link" />
</xsl:if>
<xsl:if test="geo:lat and geo:long">
<xsl:if test="category or author or enclosure or source or (icbm:latitude and icbm:longitude)">
<br />
</xsl:if>
<xsl:call-template name="geo-link" />
</xsl:if>
<xsl:if test="geourl:latitude and geourl:longitude">
<xsl:if test="category or author or enclosure or source or (icbm:latitude and icbm:longitude) or (geo:lat and geo:long)">
<br />
</xsl:if>
<xsl:call-template name="geourl-link" />
</xsl:if>
</p>
<!-- When there is nothing other than the right section, we need to clear its float: right -->
<xsl:if test="(guid or comments or slash:comments) and not(category or author or enclosure or source or (icbm:latitude and icbm:longitude) or (geo:lat and geo:long) or (geourl:latitude and geourl:longitude))">
<div class="clearfix"></div>
</xsl:if>
</footer>
</xsl:if>
</article>
</xsl:template>
<xsl:template name="icbm-link">
<span class="icon-icbm" alt="ICBM address"></span>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>https://www.openstreetmap.org/?mlat=</xsl:text>
<xsl:value-of select="icbm:latitude" />
<xsl:text>&amp;mlon=</xsl:text>
<xsl:value-of select="icbm:longitude" />
</xsl:attribute>
<xsl:value-of select="icbm:latitude" />
<xsl:text>, </xsl:text>
<xsl:value-of select="icbm:longitude" />
</a>
</xsl:template>
<xsl:template name="geo-link">
<span class="icon-geo" alt="Geolocation"></span>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>https://www.openstreetmap.org/?mlat=</xsl:text>
<xsl:value-of select="geo:lat" />
<xsl:text>&amp;mlon=</xsl:text>
<xsl:value-of select="geo:long" />
</xsl:attribute>
<xsl:value-of select="geo:lat" />
<xsl:text>, </xsl:text>
<xsl:value-of select="geo:long" />
<xsl:if test="geo:alt">
<xsl:text>, alt. </xsl:text>
<xsl:value-of select="geo:alt" />
<xsl:text> meters</xsl:text>
</xsl:if>
</a>
</xsl:template>
<xsl:template name="geourl-link">
<span class="icon-geo" alt="GeoURL.org location"></span>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>https://www.openstreetmap.org/?mlat=</xsl:text>
<xsl:value-of select="geourl:latitude" />
<xsl:text>&amp;mlon=</xsl:text>
<xsl:value-of select="geourl:longitude" />
</xsl:attribute>
<xsl:value-of select="geourl:latitude" />
<xsl:text>, </xsl:text>
<xsl:value-of select="geourl:longitude" />
</a>
</xsl:template>
<xsl:template match="nhc:Cyclone">
<hr />
<details>
<summary>
<span class="icon-cyclone" alt="Tropical weather system" />
<xsl:call-template name="titlecase">
<xsl:with-param name="text" select="./nhc:type" />
</xsl:call-template>
</summary>
<dl>
<dt>Time of report</dt>
<dd><xsl:value-of select="./nhc:datetime" /></dd>
<dt>Report headline</dt>
<dd><xsl:value-of select="./nhc:headline" /></dd>
<dt>Weather system name</dt>
<dd><xsl:value-of select="./nhc:name" /></dd>
<dt>Weather system type</dt>
<dd><xsl:value-of select="./nhc:type" /></dd>
<dt>Location</dt>
<dd>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>https://www.openstreetmap.org/?mlat=</xsl:text>
<xsl:value-of select="normalize-space(substring-before(nhc:center, ','))" />
<xsl:text>&amp;mlon=</xsl:text>
<xsl:value-of select="normalize-space(substring-after(nhc:center, ','))" />
</xsl:attribute>
<xsl:value-of select="nhc:center" />
</a>
</dd>
<dt>Wallet (<abbr title="National Hurricane Center">NHC</abbr> category)</dt>
<dd><xsl:value-of select="./nhc:wallet" /></dd>
<dt><abbr title="Automated Tropical Cyclone Forecast">ATCF</abbr> identifier</dt>
<dd><xsl:value-of select="./nhc:atcf" /></dd>
<dt>Movement</dt>
<dd><xsl:value-of select="./nhc:movement" /></dd>
<dt>Wind speed</dt>
<dd><xsl:value-of select="./nhc:wind" /></dd>
<dt>Pressure</dt>
<dd><xsl:value-of select="./nhc:pressure" /></dd>
</dl>
</details>
</xsl:template>
<xsl:template name="lowercase">
<xsl:param name="text" />
<xsl:value-of select="translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />
</xsl:template>
<xsl:template name="uppercase">
<xsl:param name="text" />
<xsl:value-of select="translate($text, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
</xsl:template>
<xsl:template name="titlecase">
<xsl:param name="text" />
<xsl:call-template name="uppercase">
<xsl:with-param name="text" select="substring($text, 1, 1)" />
</xsl:call-template>
<xsl:call-template name="lowercase">
<xsl:with-param name="text" select="substring($text, 2)" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>