Support RSS 1.0 Service Status in XSLT

This commit is contained in:
~lucidiot 2023-11-18 08:52:24 +01:00
parent ad71f1ba8f
commit 15f433c18b
3 changed files with 92 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

BIN
img/sprites/bullet-red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

View File

@ -14,6 +14,7 @@
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"
@ -22,6 +23,7 @@
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" />
@ -94,7 +96,7 @@
</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 blogChannel:blogRoll or blogChannel:blink or blogChannel:mySubscriptions">
<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">
@ -433,6 +435,15 @@
</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>
@ -543,6 +554,86 @@
<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="category or guid or source or author or comments or slash:comments or (icbm:latitude and icbm:longitude) or (geo:lat and geo:long) or (geourl:latitude and geourl:longitude)">
<footer>
<p>