7d358e1bc4
TA-SILC: Folien als resource git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@1033 31f61c52-7bfb-0310-b897-fc00f8a278f0
159 lines
5.4 KiB
XML
159 lines
5.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:date="http://exslt.org/dates-and-times"
|
|
exclude-result-prefixes="xsl date">
|
|
|
|
<xsl:include href="common.xsl" />
|
|
|
|
<xsl:output method="xml"
|
|
version="1.0"
|
|
encoding="utf-8"
|
|
indent="yes"/>
|
|
|
|
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
|
|
|
|
<xsl:template match="news">
|
|
<xsl:element name="rss">
|
|
<xsl:attribute name="version">2.0</xsl:attribute>
|
|
<!--xsl:attribute name="xml:lang">de</xsl:attribute-->
|
|
|
|
<channel>
|
|
<title>www.c3d2.de Newsfeed</title>
|
|
<link>https://www.c3d2.de/</link>
|
|
<description>Neues aus dem Chaos Computer Club Dresden</description>
|
|
<language>de-de</language>
|
|
<!-- TODO: Insert "now": <pubDate><xsl:value-of select="news/item/@date"/></pubDate> -->
|
|
<xsl:for-each select="newsfile">
|
|
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
|
<xsl:if test="position() <= 10">
|
|
|
|
<xsl:apply-templates select="document(.)/item">
|
|
<xsl:with-param name="newsfile" select="."/>
|
|
</xsl:apply-templates>
|
|
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
</channel>
|
|
|
|
</xsl:element>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="item">
|
|
<xsl:param name="newsfile"/>
|
|
<item>
|
|
<xsl:variable name="href">
|
|
<xsl:value-of select="$baseurl"/>
|
|
<xsl:value-of select="substring-before(substring-after($newsfile, 'content/'), '.xml')"/>
|
|
<xsl:text>.html</xsl:text>
|
|
</xsl:variable>
|
|
|
|
<title><xsl:value-of select="@title"/></title>
|
|
<description><xsl:apply-templates mode="escaped"/></description>
|
|
<link><xsl:value-of select="$href"/></link>
|
|
<author><xsl:value-of select="@author"/></author>
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="starts-with($newsfile, 'content/news/ta-')">
|
|
<category>Themenabend</category>
|
|
</xsl:when>
|
|
<xsl:when test="starts-with($newsfile, 'content/news/event-')">
|
|
<category>Event</category>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<category>Misc</category>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
|
|
<guid isPermaLink="true"><xsl:value-of select="$href"/></guid>
|
|
|
|
<pubDate>
|
|
<xsl:call-template name="date-to-rfc822">
|
|
<xsl:with-param name="date" select="@date"/>
|
|
</xsl:call-template>
|
|
</pubDate>
|
|
<!--
|
|
TODO:
|
|
Jemand mit iTunes (erhältlich für OSX und Windows)
|
|
muss mal die itunes-extensions einbauen:
|
|
http://www.apple.com/itunes/podcasts/techspecs.html
|
|
-->
|
|
<xsl:for-each select="resource">
|
|
<xsl:variable name="resource_href">
|
|
<xsl:call-template name="make-href">
|
|
<xsl:with-param name="href" select="@url"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<enclosure url="{$resource_href}"
|
|
length="{@size}"
|
|
type="{@type}" />
|
|
</xsl:for-each>
|
|
</item>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="pre" mode="escaped">
|
|
<pre><xsl:apply-templates mode="escaped"/></pre>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="p" mode="escaped">
|
|
<p><xsl:apply-templates mode="escaped"/></p>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="image" mode="escaped">
|
|
<xsl:variable name="url"><xsl:choose>
|
|
<xsl:when test="contains(., '://')"><xsl:value-of select="."/></xsl:when>
|
|
<xsl:otherwise><xsl:value-of select="concat($baseurl, 'images/news/', .)"/></xsl:otherwise>
|
|
</xsl:choose></xsl:variable>
|
|
|
|
<img src="<xsl:value-of select="$url"/>"<xsl:if test="@title"> title="<xsl:value-of select="@title"/>" alt="<xsl:value-of select="@title"/>"</xsl:if><xsl:if test="@class"> class="<xsl:value-of select="@class"/>"</xsl:if>/>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="link" mode="escaped">
|
|
<xsl:variable name="href"><xsl:choose>
|
|
<xsl:when test="@href"><xsl:value-of select="@href"/></xsl:when>
|
|
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
|
</xsl:choose></xsl:variable>
|
|
|
|
<a href="<xsl:choose>
|
|
<xsl:when test="contains($href, ':')"><xsl:value-of select="$href"/></xsl:when>
|
|
<xsl:otherwise><xsl:value-of select="concat($baseurl, $href)"/></xsl:otherwise>
|
|
</xsl:choose>"><xsl:apply-templates mode="escaped"/></a>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="resource" mode="escaped"/>
|
|
|
|
<!-- Support für <event/> -->
|
|
<xsl:template match="item/event/start" mode="escaped">
|
|
<dl>
|
|
<dt>
|
|
<xsl:choose>
|
|
<xsl:when test="../end">Beginn</xsl:when>
|
|
<xsl:otherwise>Datum</xsl:otherwise>
|
|
</xsl:choose>
|
|
</dt>
|
|
<dd>
|
|
<xsl:call-template name="get-datestring">
|
|
<xsl:with-param name="date" select="."/>
|
|
</xsl:call-template>
|
|
</dd>
|
|
</dl>
|
|
</xsl:template>
|
|
<xsl:template match="item/event/end" mode="escaped">
|
|
<dl>
|
|
<dt>Ende</dt>
|
|
<dd>
|
|
<xsl:call-template name="get-datestring">
|
|
<xsl:with-param name="date" select="."/>
|
|
</xsl:call-template>
|
|
</dd>
|
|
</dl>
|
|
</xsl:template>
|
|
<xsl:template match="item/event/location" mode="escaped">
|
|
<dl>
|
|
<dt>Ort</dt>
|
|
<dd><xsl:apply-templates/></dd>
|
|
</dl>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|