215 lines
6.4 KiB
XML
215 lines
6.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:itsb="http://tilde.town/~lucidiot/itsb/itsb.xsd">
|
|
<xsl:output method="html" />
|
|
|
|
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
|
|
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
|
|
<xsl:key name="feedKey" match="itsb:feed" use="concat(../@id, ' ', @lang, ' ', @type)" />
|
|
|
|
<xsl:template match="/">
|
|
<html>
|
|
<head>
|
|
<title>international transport safety bureau</title>
|
|
<link rel="stylesheet" type="text/css" href="../theme.css" />
|
|
<link rel="shortcut icon" type="image/x-icon" href="../img/favicon.ico"/>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="author" content="~lucidiot" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
</head>
|
|
<body class="container" id="top">
|
|
<div class="centered">
|
|
<img src="img/itsb.gif" alt="itsb logo: an antenna receives an alert from an airplane" />
|
|
<h1>international transport safety bureau</h1>
|
|
<p>
|
|
<xsl:for-each select="//itsb:section">
|
|
<a href="{concat('#', @id)}">
|
|
<xsl:value-of select="@name" />
|
|
</a>
|
|
<xsl:if test="position() != last()">
|
|
<xsl:text> — </xsl:text>
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
</p>
|
|
</div>
|
|
|
|
<xsl:apply-templates />
|
|
</body>
|
|
</html>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:section">
|
|
<div class="section" id="{@id}">
|
|
<a href="#top" class="toplink">back to top</a>
|
|
<h2>
|
|
<xsl:value-of select="@name" />
|
|
</h2>
|
|
<xsl:apply-templates />
|
|
</div>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:content">
|
|
<xsl:value-of select="text()" disable-output-escaping="yes" />
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:source">
|
|
<h3 id="{@id}">
|
|
<xsl:value-of select="itsb:name/text()" />
|
|
</h3>
|
|
<xsl:apply-templates select="itsb:description" />
|
|
<table>
|
|
<tbody>
|
|
<xsl:apply-templates select="itsb:region | itsb:type | itsb:frequency | itsb:license | itsb:url" />
|
|
<xsl:choose>
|
|
<xsl:when test="count(itsb:feed[generate-id(.) = generate-id(key('feedKey', concat(../@id, ' ', @lang, ' ', @type)))]) = 1">
|
|
<tr>
|
|
<td>
|
|
<strong>Language</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:value-of select="itsb:feed/@lang" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<strong>Feed</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:apply-templates select="itsb:feed">
|
|
<xsl:sort select="@format" />
|
|
</xsl:apply-templates>
|
|
</td>
|
|
</tr>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<tr>
|
|
<td>
|
|
<strong>Feeds</strong>
|
|
</td>
|
|
<td>
|
|
<table>
|
|
<tbody>
|
|
<xsl:for-each select="itsb:feed[generate-id(.) = generate-id(key('feedKey', concat(../@id, ' ', @lang, ' ', @type)))]">
|
|
<xsl:sort select="@lang" />
|
|
<xsl:sort select="@type" />
|
|
<xsl:variable name="lang" select="@lang" />
|
|
<xsl:variable name="type" select="@type" />
|
|
|
|
<tr>
|
|
<td>
|
|
<xsl:value-of select="concat(translate(substring($lang, 1, 1), $lowercase, $uppercase), substring($lang, 2))" />
|
|
<xsl:if test="$lang and $type">
|
|
<xsl:text>, </xsl:text>
|
|
</xsl:if>
|
|
<xsl:value-of select="concat(translate(substring($type, 1, 1), $lowercase, $uppercase), substring($type, 2))" />
|
|
</td>
|
|
|
|
<td>
|
|
<xsl:apply-templates select="../itsb:feed[(@lang = $lang or (not(@lang) and not ($lang))) and (@type = $type or (not(@type) and not($type)))]">
|
|
<xsl:sort select="@format" />
|
|
</xsl:apply-templates>
|
|
</td>
|
|
</tr>
|
|
</xsl:for-each>
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</tbody>
|
|
</table>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:description">
|
|
<xsl:value-of select="text()" disable-output-escaping="yes" />
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:region">
|
|
<tr>
|
|
<td>
|
|
<strong>Region</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:value-of select="text()" />
|
|
</td>
|
|
</tr>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:type">
|
|
<tr>
|
|
<td>
|
|
<strong>Types</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:value-of select="text()" />
|
|
</td>
|
|
</tr>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:frequency">
|
|
<tr>
|
|
<td>
|
|
<strong>Frequency</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:value-of select="text()" />
|
|
</td>
|
|
</tr>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:license">
|
|
<tr>
|
|
<td>
|
|
<strong>License</strong>
|
|
</td>
|
|
<td>
|
|
<xsl:choose>
|
|
<xsl:when test="@url">
|
|
<a href="{@url}" target="_blank">
|
|
<xsl:value-of select="text()" />
|
|
</a>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="text()" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</td>
|
|
</tr>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:url">
|
|
<tr>
|
|
<td>
|
|
<strong>Website</strong>
|
|
</td>
|
|
<td>
|
|
<a href="{text()}" target="_blank">
|
|
<xsl:value-of select="text()" />
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="itsb:feed">
|
|
<xsl:variable name="href">
|
|
<xsl:choose>
|
|
<xsl:when test="itsb:link">
|
|
<xsl:value-of select="itsb:link/text()" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>feeds/</xsl:text>
|
|
<xsl:value-of select="itsb:output/text()" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<a href="{$href}" target="_blank">
|
|
<img src="img/{@format}.gif" alt="{@format}" />
|
|
</a>
|
|
<xsl:text> </xsl:text>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|