06a9c057b9
* Links http statt https * summary -> subtitle * Aussagekräftiger summary * author * podcast beschränkt auf pentaradio * immer guid/@isPermaLink='false' git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@623 31f61c52-7bfb-0310-b897-fc00f8a278f0
154 lines
5.4 KiB
XML
154 lines
5.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- Spezifikation:
|
|
http://www.apple.com/itunes/store/podcaststechspecs.html
|
|
-->
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:date="http://exslt.org/dates-and-times"
|
|
exclude-result-prefixes="xsl date">
|
|
|
|
<xsl:output method="xml"
|
|
version="1.0"
|
|
encoding="utf-8"
|
|
indent="yes"/>
|
|
|
|
<xsl:include href="date.xsl" />
|
|
|
|
<xsl:variable name="baseurl">http://www.c3d2.de/</xsl:variable>
|
|
|
|
<xsl:template match="news">
|
|
<rss version="2.0">
|
|
|
|
<channel>
|
|
<title>C3D2 Podcast</title>
|
|
<link><xsl:value-of select="$baseurl"/>radio.html</link>
|
|
<description>Pentaradio als MP3</description>
|
|
<language>de</language>
|
|
<copyright>http://creativecommons.org/licenses/by-sa/2.0/de/</copyright>
|
|
<itunes:subtitle>Radio vom CCC Dresden</itunes:subtitle>
|
|
<itunes:summary>
|
|
Pentaradio sind unregelmäßige Sendungen auf coloRadio, bestehend aus einem informativen Rahmenprogramm und Beiträgen zu einem sendungsspezifischen Thema.
|
|
</itunes:summary>
|
|
<itunes:image href="{$baseurl}images/ck.png" />
|
|
<itunes:category text="Society & culture"/>
|
|
<itunes:category text="Talk">
|
|
<itunes:category text="Radio"/>
|
|
</itunes:category>
|
|
<itunes:author>Chaos Computer Club Dresden</itunes:author>
|
|
|
|
<xsl:for-each select="newsfile">
|
|
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
|
<!--xsl:if test="position() <= 10"-->
|
|
<xsl:if test="starts-with(., 'content/news/pentaradio') and (count(document(.)/item/resource) > 0)">
|
|
|
|
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
|
|
<xsl:with-param name="newsfile" select="."/>
|
|
</xsl:apply-templates>
|
|
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
</channel>
|
|
|
|
</rss>
|
|
</xsl:template>
|
|
|
|
<!-- Preselect heißt:
|
|
* Gucken, ob es in der Resource nicht ein Alternative gibt, welches MP3 ist
|
|
* Dann dieses nehmen
|
|
* Ansonsten die Resource nehmen
|
|
-->
|
|
<xsl:template match="resource" mode="preselect">
|
|
<xsl:param name="newsfile"/>
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="count(alternative[@type='audio/mpeg']) > 0">
|
|
<xsl:apply-templates test="alternative[@type='audio/mpeg'][1]">
|
|
<xsl:with-param name="newsfile" select="$newsfile"/>
|
|
</xsl:apply-templates>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:apply-templates select=".">
|
|
<xsl:with-param name="newsfile" select="$newsfile"/>
|
|
</xsl:apply-templates>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="resource">
|
|
<xsl:param name="newsfile"/>
|
|
|
|
<xsl:call-template name="generate-item">
|
|
<xsl:with-param name="newsfile" select="$newsfile"/>
|
|
<xsl:with-param name="item_title" select="../@title"/>
|
|
<xsl:with-param name="resource_title" select="@title"/>
|
|
<xsl:with-param name="author" select="../@author"/>
|
|
<xsl:with-param name="date" select="../@date"/>
|
|
<xsl:with-param name="resource_url" select="@url"/>
|
|
<xsl:with-param name="resource_size" select="@size"/>
|
|
<xsl:with-param name="resource_type" select="@type"/>
|
|
</xsl:call-template>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="alternative">
|
|
<xsl:param name="newsfile"/>
|
|
|
|
<xsl:call-template name="generate-item">
|
|
<xsl:with-param name="newsfile" select="$newsfile"/>
|
|
<xsl:with-param name="item_title" select="../../@title"/>
|
|
<xsl:with-param name="resource_title" select="../@title"/>
|
|
<xsl:with-param name="author" select="../../@author"/>
|
|
<xsl:with-param name="date" select="../../@date"/>
|
|
<xsl:with-param name="resource_url" select="@url"/>
|
|
<xsl:with-param name="resource_size" select="@size"/>
|
|
<xsl:with-param name="resource_type" select="@type"/>
|
|
</xsl:call-template>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="generate-item">
|
|
<xsl:param name="newsfile"/>
|
|
<xsl:param name="item_title"/>
|
|
<xsl:param name="resource_title"/>
|
|
<xsl:param name="author"/>
|
|
<xsl:param name="date"/>
|
|
<xsl:param name="resource_url"/>
|
|
<xsl:param name="resource_size"/>
|
|
<xsl:param name="resource_type"/>
|
|
|
|
<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="$resource_title"/></title>
|
|
<link><xsl:value-of select="$href"/></link>
|
|
|
|
<enclosure
|
|
url="{$resource_url}"
|
|
length="{$resource_size}"
|
|
type="{$resource_type}"
|
|
/>
|
|
|
|
<guid isPermaLink="false"><xsl:value-of select="concat($href, '+++', $resource_url)"/></guid>
|
|
|
|
<pubDate>
|
|
<xsl:call-template name="date-to-rfc822">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</pubDate>
|
|
|
|
<!-- iTunes-Extensions zum Schluss, sonst validiert es nicht -->
|
|
|
|
<itunes:subtitle><xsl:value-of select="$item_title"/></itunes:subtitle>
|
|
<!-- RSS author möchte immer Mail-Adresse, deshalb lieber itunes:author -->
|
|
<itunes:author><xsl:value-of select="$author"/></itunes:author>
|
|
|
|
</item>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|