325 lines
10 KiB
XML
325 lines
10 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<xsl:stylesheet version="1.0"
|
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:atom="http://www.w3.org/2005/Atom"
|
|
xmlns:date="http://exslt.org/dates-and-times"
|
|
xmlns:str="http://exslt.org/strings"
|
|
exclude-result-prefixes="xsl atom date str">
|
|
|
|
<xsl:template match="pre">
|
|
<pre><xsl:apply-templates/></pre>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="p">
|
|
<xsl:if test="@title">
|
|
<h3>
|
|
<xsl:value-of select="@title"/>
|
|
</h3>
|
|
</xsl:if>
|
|
<p class="{@class}">
|
|
<xsl:apply-templates/>
|
|
</p>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="dl">
|
|
<dl class="{@class}">
|
|
<xsl:apply-templates/>
|
|
</dl>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="dh">
|
|
<dt class="main"><xsl:apply-templates/></dt>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="dt">
|
|
<dt><xsl:apply-templates/></dt>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="dd">
|
|
<dd><xsl:apply-templates/></dd>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="ul">
|
|
<ul><xsl:apply-templates/></ul>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="ol">
|
|
<ol><xsl:apply-templates/></ol>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="li">
|
|
<li><xsl:apply-templates/></li>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="image">
|
|
<img
|
|
src="{.}"
|
|
title="{@title}"
|
|
alt="{@title}"
|
|
class="{@class}"/>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="link">
|
|
<xsl:variable name="href">
|
|
<xsl:call-template name="make-href">
|
|
<xsl:with-param name="href" select="@href"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<a href="{$href}">
|
|
<xsl:if test="@class">
|
|
<xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
|
|
</xsl:if>
|
|
|
|
<xsl:apply-templates/>
|
|
</a>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="make-href">
|
|
<xsl:param name="href"/>
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="$href and not(contains($href, ':'))">
|
|
<xsl:value-of select="concat($baseurl,$href)"/>
|
|
</xsl:when>
|
|
<xsl:when test="$href">
|
|
<xsl:value-of select="$href"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="."/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="em">
|
|
<em>
|
|
<xsl:value-of select="."/>
|
|
</em>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="xhtml:*"
|
|
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
<xsl:copy-of select="."/>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="addendum">
|
|
<!--
|
|
Wenn wir nicht in news/ oder anderem sind, dann
|
|
zeige nicht vollen Newstext (<addendum/>)
|
|
-->
|
|
<xsl:if test="string-length($baseurl) > 0">
|
|
<xsl:apply-templates/>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!-- Resources gehören nicht zum generellen Artikeltext
|
|
und kommen explizit danach -->
|
|
<xsl:template match="resource"/>
|
|
|
|
<xsl:template name="navitem">
|
|
<xsl:param name="file"/>
|
|
<xsl:param name="baseurl"/>
|
|
<xsl:param name="title"/>
|
|
<li>
|
|
<a href="{$baseurl}{$file}.html">
|
|
<xsl:choose>
|
|
<xsl:when test="string-length($title) = 0">
|
|
<xsl:if test="document(concat('../content/pages/', $file, '.xml'))/page/@pagetitle">
|
|
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/pages/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
|
|
</xsl:if>
|
|
|
|
<xsl:value-of select="document(concat('../content/pages/', $file, '.xml'))/page/@title"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="$title"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</a>
|
|
</li>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="navitems">
|
|
<ul>
|
|
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
|
|
<xsl:call-template name="navitem">
|
|
<xsl:with-param name="file" select="."/>
|
|
<xsl:with-param name="title" select="@title"/>
|
|
<xsl:with-param name="baseurl" select="$baseurl"/>
|
|
</xsl:call-template>
|
|
</xsl:for-each>
|
|
</ul>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="chaosupdates">
|
|
<xsl:param name="limit" select="5"/>
|
|
<div id="news">
|
|
<h2>
|
|
<a href="{document('../chaosupdates.xml')/atom:feed/atom:link[not(@rel = 'self')]/@href}">
|
|
<xsl:value-of select="document('../chaosupdates.xml')/atom:feed/atom:title"/>
|
|
</a>
|
|
</h2>
|
|
<ul>
|
|
<xsl:for-each select="document('../chaosupdates.xml')/atom:feed/atom:entry[position() <= $limit]">
|
|
<li>
|
|
<a href="{atom:link[@rel = 'alternate']/@href}">
|
|
<xsl:value-of select="atom:title"/>
|
|
</a>
|
|
</li>
|
|
</xsl:for-each>
|
|
</ul>
|
|
</div> <!-- id="news" -->
|
|
</xsl:template>
|
|
|
|
<xsl:template name="calendar-events">
|
|
<xsl:param name="limit" select="5"/>
|
|
<xsl:if test="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) >= date:seconds(date:date())]">
|
|
<div id="upcoming">
|
|
<h2>
|
|
<a href="{$baseurl}calendar.html">Kalender</a>
|
|
</h2>
|
|
<ul>
|
|
<xsl:for-each select="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) >= date:seconds(date:date())]">
|
|
<xsl:sort select="date:seconds(start)" data-type="number" order="ascending" />
|
|
|
|
<xsl:if test="position() <= $limit">
|
|
<xsl:variable name="href">
|
|
<xsl:call-template name="make-href">
|
|
<xsl:with-param name="href" select="link"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<li>
|
|
<xsl:call-template name="datespan-to-human">
|
|
<xsl:with-param name="start" select="start"/>
|
|
<xsl:with-param name="end" select="end"/>
|
|
</xsl:call-template>:
|
|
<a href="{$href}">
|
|
<xsl:value-of select="title"/>
|
|
</a>
|
|
|
|
<xsl:if test="location">
|
|
<xsl:text> </xsl:text>
|
|
<span class="location"><xsl:value-of select="location"/></span>
|
|
</xsl:if>
|
|
</li>
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
</ul>
|
|
</div>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!-- Support für <event/> bzw. Microformats -->
|
|
<xsl:include href="date.xsl" />
|
|
<xsl:template match="item/event/start">
|
|
<xsl:variable name="date" select="."/>
|
|
|
|
<dl>
|
|
<dt>
|
|
<xsl:choose>
|
|
<xsl:when test="../end">Beginn</xsl:when>
|
|
<xsl:otherwise>Datum</xsl:otherwise>
|
|
</xsl:choose>
|
|
</dt>
|
|
<dd>
|
|
<abbr class="dtstart">
|
|
<xsl:attribute name="title">
|
|
<xsl:call-template name="date-to-hevent">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</xsl:attribute>
|
|
|
|
<xsl:call-template name="get-datestring">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</abbr>
|
|
</dd>
|
|
</dl>
|
|
</xsl:template>
|
|
<xsl:template match="item/event/end">
|
|
<xsl:variable name="date" select="."/>
|
|
|
|
<dl>
|
|
<dt>Ende</dt>
|
|
<dd>
|
|
<abbr class="dtend">
|
|
<xsl:attribute name="title">
|
|
<xsl:call-template name="date-to-hevent">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</xsl:attribute>
|
|
|
|
<xsl:call-template name="get-datestring">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</abbr>
|
|
</dd>
|
|
</dl>
|
|
</xsl:template>
|
|
<xsl:template match="item/event/location">
|
|
<dl>
|
|
<dt>Ort</dt>
|
|
<dd class="location"><xsl:apply-templates/></dd>
|
|
</dl>
|
|
</xsl:template>
|
|
|
|
|
|
<xsl:template name="format-filesize">
|
|
<xsl:param name="value"/>
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="$value > 1024 * 1024 * 1024">
|
|
<xsl:value-of select="format-number($value div (1024 * 1024 * 1024), '0.0')"/>
|
|
<xsl:text> GB</xsl:text>
|
|
</xsl:when>
|
|
<xsl:when test="$value > 1024 * 1024">
|
|
<xsl:value-of select="format-number($value div (1024 * 1024), '0.0')"/>
|
|
<xsl:text> MB</xsl:text>
|
|
</xsl:when>
|
|
<xsl:when test="$value > 1024">
|
|
<xsl:value-of select="format-number($value div (1024), '0.0')"/>
|
|
<xsl:text> KB</xsl:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="$value"/>
|
|
<xsl:text> Bytes</xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="mime-for-human">
|
|
<xsl:param name="mime"/>
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="$mime = 'application/ogg'">Ogg Vorbis</xsl:when>
|
|
<xsl:when test="$mime = 'audio/mpeg'">MPEG-Audio</xsl:when>
|
|
<xsl:when test="$mime = 'application/octet-stream'">Binärdatei</xsl:when>
|
|
<xsl:when test="$mime = 'application/xhtml+xml'">XHTML-Dokument</xsl:when>
|
|
<xsl:when test="$mime = 'text/html'">HTML-Dokument</xsl:when>
|
|
<xsl:when test="$mime = 'text/plain'">Text-Dokument</xsl:when>
|
|
<xsl:when test="$mime = 'application/pdf'">Portable Document Format</xsl:when>
|
|
<xsl:when test="$mime = 'image/svg+xml'">Scalable Vector Graphics</xsl:when>
|
|
<xsl:when test="$mime = 'image/gif'">GIF-Bild</xsl:when>
|
|
<xsl:when test="$mime = 'image/jpeg'">JPEG-Bild</xsl:when>
|
|
<xsl:when test="$mime = 'image/png'">PNG-Bild</xsl:when>
|
|
<xsl:when test="$mime = 'video/mpeg'">MPEG-Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/mp4'">MP4-Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/quicktime'">QuickTime-Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/x-ms-wmv'">Windows Media-Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/x-msvideo'">Video for Windows</xsl:when>
|
|
<xsl:when test="$mime = 'video/avi'">Audio Video Interleave</xsl:when>
|
|
<xsl:when test="$mime = 'video/ogg'">Ogg Media Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/x-matroska'">Matroska Video</xsl:when>
|
|
<xsl:when test="$mime = 'video/x-m4v'">iTunes Video File</xsl:when>
|
|
<xsl:when test="$mime = 'application/x-gtar'">Komprimierter Tarball</xsl:when>
|
|
<xsl:when test="$mime = 'application/x-tar'">Tarball</xsl:when>
|
|
<xsl:when test="$mime = 'application/x-bittorrent'">BitTorrent-Metainformationen</xsl:when>
|
|
<xsl:when test="$mime = 'application/zip'">ZIP-Archiv</xsl:when>
|
|
<xsl:when test="$mime = 'multipart/x-zip'">ZIP-Archiv</xsl:when>
|
|
<xsl:otherwise>Datei</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|