|
|
|
@ -1,17 +1,21 @@
|
|
|
|
|
<?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"
|
|
|
|
|
xmlns:crypto="http://exslt.org/crypto"
|
|
|
|
|
>
|
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
|
xmlns:date="http://exslt.org/dates-and-times"
|
|
|
|
|
xmlns:crypto="http://exslt.org/crypto">
|
|
|
|
|
|
|
|
|
|
<xsl:output method="text" encoding="utf-8"/>
|
|
|
|
|
|
|
|
|
|
<xsl:include href="date.xsl"/>
|
|
|
|
|
<xsl:include href="common.xsl"/>
|
|
|
|
|
|
|
|
|
|
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="news"><xsl:text>BEGIN:VCALENDAR</xsl:text>
|
|
|
|
|
<xsl:template match="/page">
|
|
|
|
|
<xsl:apply-templates select="calendar-summary"/>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="calendar-summary">
|
|
|
|
|
<xsl:text>BEGIN:VCALENDAR</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:text>VERSION:2.0</xsl:text>
|
|
|
|
@ -32,93 +36,106 @@
|
|
|
|
|
<xsl:text>X-WR-CALNAME;VALUE=TEXT:C3D2-Events</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:text>X-WR-TIMEZONE;VALUE=TEXT:Europe/Berlin</xsl:text>
|
|
|
|
|
<xsl:text>X-WR-TIMEZONE;VALUE=TEXT:Europe/Prague</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:for-each select="newsfile">
|
|
|
|
|
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
|
|
|
|
<xsl:if test="document(.)/item/event">
|
|
|
|
|
<xsl:apply-templates select="document(.)/item">
|
|
|
|
|
<xsl:with-param name="newsfile" select="."/>
|
|
|
|
|
</xsl:apply-templates>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
<xsl:for-each select="event">
|
|
|
|
|
<xsl:sort select="date:seconds(@start)" data-type="number" order="descending" />
|
|
|
|
|
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:text>END:VCALENDAR</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:text>BEGIN:VEVENT</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="item">
|
|
|
|
|
<xsl:param name="newsfile"/>
|
|
|
|
|
<xsl:text>METHOD:PUBLISH</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:text>BEGIN:VEVENT</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:call-template name="uid"/>
|
|
|
|
|
<xsl:apply-templates select="start"/>
|
|
|
|
|
<xsl:apply-templates select="end"/>
|
|
|
|
|
<xsl:apply-templates select="title"/>
|
|
|
|
|
<xsl:text>CLASS:PUBLIC</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:call-template name="category"/>
|
|
|
|
|
<xsl:apply-templates select="link"/>
|
|
|
|
|
<xsl:apply-templates select="location"/>
|
|
|
|
|
|
|
|
|
|
<xsl:text>METHOD:PUBLISH</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:text>END:VEVENT</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
<xsl:text>UID:</xsl:text><xsl:value-of select="crypto:sha1(concat(@title,@date))"/><xsl:text>@www.c3d2.de</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:text>END:VCALENDAR</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:text>DTSTAMP:</xsl:text>
|
|
|
|
|
<xsl:call-template name="date-to-hevent">
|
|
|
|
|
<xsl:with-param name="date" select="@date"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:template name="uid">
|
|
|
|
|
<xsl:text>UID:</xsl:text><xsl:value-of select="crypto:sha1(concat(title,start))"/><xsl:text>@www.c3d2.de</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="start">
|
|
|
|
|
<xsl:text>DTSTART:</xsl:text>
|
|
|
|
|
<xsl:call-template name="date-to-hevent">
|
|
|
|
|
<xsl:with-param name="date" select="event/start"/>
|
|
|
|
|
<xsl:with-param name="date" select="string(.)"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:if test="event/end">
|
|
|
|
|
<xsl:template match="end">
|
|
|
|
|
<xsl:if test="not(string(.) = string(../start))">
|
|
|
|
|
<xsl:text>DTEND:</xsl:text>
|
|
|
|
|
<xsl:call-template name="date-to-hevent">
|
|
|
|
|
<xsl:with-param name="date" select="event/end"/>
|
|
|
|
|
<xsl:with-param name="date" select="string(.)"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="title">
|
|
|
|
|
<xsl:call-template name="wrap-text">
|
|
|
|
|
<xsl:with-param name="text">SUMMARY:<xsl:value-of select="@title"/></xsl:with-param>
|
|
|
|
|
<xsl:with-param name="text">SUMMARY:<xsl:value-of select="."/></xsl:with-param>
|
|
|
|
|
<xsl:with-param name="length" select="70"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:text>CLASS:PUBLIC</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:template name="category">
|
|
|
|
|
<xsl:text>CATEGORY:</xsl:text>
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="starts-with($newsfile, 'content/news/ta-')">
|
|
|
|
|
<item>Themenabend</item>
|
|
|
|
|
<xsl:when test="starts-with(link, 'news/ta-')">
|
|
|
|
|
<xsl:text>Themenabend</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="starts-with(link, 'news/event-')">
|
|
|
|
|
<xsl:text>Event</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="starts-with(link, 'news/pentaradio')">
|
|
|
|
|
<xsl:text>Radio</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="starts-with($newsfile, 'content/news/event-')">
|
|
|
|
|
<item>Event</item>
|
|
|
|
|
<xsl:when test="link = 'radio.html'">
|
|
|
|
|
<xsl:text>Radio</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<item>Misc</item>
|
|
|
|
|
<xsl:text>Misc</xsl:text>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="link">
|
|
|
|
|
<xsl:text>URL:</xsl:text>
|
|
|
|
|
<xsl:value-of select="$baseurl"/>
|
|
|
|
|
<xsl:value-of select="substring-after(substring-before($newsfile, '.xml'), 'content/')"/>
|
|
|
|
|
<xsl:text>.html</xsl:text>
|
|
|
|
|
<xsl:call-template name="make-href">
|
|
|
|
|
<xsl:with-param name="href" select="string(.)"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="location">
|
|
|
|
|
<xsl:call-template name="wrap-text">
|
|
|
|
|
<xsl:with-param name="text">LOCATION:<xsl:value-of select="event/location"/></xsl:with-param>
|
|
|
|
|
<xsl:with-param name="text">LOCATION:<xsl:value-of select="string(.)"/></xsl:with-param>
|
|
|
|
|
<xsl:with-param name="length" select="70"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
<xsl:text>END:VEVENT</xsl:text>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<!-- Copy left by Tim Pritlove -->
|
|
|
|
|