You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
229 lines
8.2 KiB
XML
229 lines
8.2 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:date="http://exslt.org/dates-and-times"
|
|
exclude-result-prefixes="xsl date">
|
|
|
|
|
|
<xsl:import href="date.week-in-year.function.xsl" />
|
|
<xsl:include href="ddate.xsl" />
|
|
|
|
<xsl:template match="/page/calendar-summary">
|
|
<table class="calendar">
|
|
<tr>
|
|
<th>Montag</th>
|
|
<th>Dienstag</th>
|
|
<th>Mittwoch</th>
|
|
<th>Donnerstag</th>
|
|
<th>Freitag</th>
|
|
<th>Sonnabend</th>
|
|
<th>Sonntag</th>
|
|
</tr>
|
|
|
|
<xsl:call-template name="output-week">
|
|
<xsl:with-param name="date">
|
|
<xsl:call-template name="get-past-monday">
|
|
<xsl:with-param name="date" select="concat(date:year(date:date()), '-', format-number(date:month-in-year(date:date()), '00'), '-01')"/>
|
|
</xsl:call-template>
|
|
</xsl:with-param>
|
|
<xsl:with-param name="stopmonth" select="date:month-in-year(date:add(date:date(), 'P2M'))"/>
|
|
</xsl:call-template>
|
|
|
|
</table>
|
|
|
|
<p>
|
|
Der Kalender ist auch im <a href="{$baseurl}ical.ics">iCal-</a>,
|
|
<a href="{$baseurl}xcal.xml">XCal-</a> und <a
|
|
href="{$baseurl}reminders">remind-Format</a> verfügbar.
|
|
</p>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="output-week">
|
|
<xsl:param name="date"/>
|
|
<xsl:param name="stopmonth"/>
|
|
<tr>
|
|
<xsl:call-template name="output-day">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</tr>
|
|
|
|
<xsl:variable name="nextweek" select="date:add($date, 'P7D')"/>
|
|
<xsl:if test="date:month-in-year($nextweek) != $stopmonth">
|
|
<xsl:call-template name="output-week">
|
|
<xsl:with-param name="date" select="$nextweek"/>
|
|
<xsl:with-param name="stopmonth" select="$stopmonth"/>
|
|
</xsl:call-template>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!--
|
|
td/@class ist wie folgend aufgebaut:
|
|
* Beginnt immer mit 'cal'
|
|
* Dann 'week' für Wochentage, 'sun' für Sonntage
|
|
* '1' für aktuellen Monat, '2' für folgenden Monat, '3' für sonstige Monate
|
|
-->
|
|
<xsl:template name="output-day">
|
|
<xsl:param name="date"/>
|
|
<xsl:variable name="today"><xsl:value-of select="substring(date:date(),1,10)"/></xsl:variable>
|
|
<td>
|
|
<xsl:attribute name="class"><xsl:if test="$today = $date">today </xsl:if>
|
|
<xsl:text>cal</xsl:text>
|
|
<xsl:choose>
|
|
<xsl:when test="date:day-in-week($date) = 1">sun</xsl:when>
|
|
<xsl:otherwise>week</xsl:otherwise>
|
|
</xsl:choose>
|
|
<xsl:choose>
|
|
<xsl:when test="date:month-in-year($date) = date:month-in-year(date:date())">1</xsl:when>
|
|
<xsl:when test="date:month-in-year($date) = date:month-in-year(date:add(date:date(), 'P1M'))">2</xsl:when>
|
|
<xsl:otherwise>3</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:attribute>
|
|
<!-- vv01f: added id to jump to a specific date with links and hashtag liek {$month}-{$day} //-->
|
|
<xsl:attribute name="id">
|
|
<xsl:value-of select="concat('eventday-', date:month-in-year($date), '-', date:day-in-month($date))"/>
|
|
</xsl:attribute>
|
|
|
|
<xsl:variable name="ddate">
|
|
<xsl:call-template name="ddate">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="$today = $date"><a name="today"/></xsl:if><!-- vv01f: ancor so that #today is the link to current day -->
|
|
|
|
<!-- clou'd calendar week for XSLT 1.0 from http://exslt.org/date/functions/week-in-year/index.html (by "Jeni Tennison" <mail@jenitennison.com>) -->
|
|
<xsl:if test="date:day-in-week($date) = 2">
|
|
<xsl:variable name="calweek">
|
|
<xsl:value-of select="date:week-in-year($date)"/>
|
|
<!-- XSLT 2.0 <xsl:value-of select="date:format-date(date,'[W]')"/-->
|
|
</xsl:variable>
|
|
<span class="calweek" id="calweek-{$calweek}" title="{$calweek}. Kalenderwoche">
|
|
<xsl:value-of select="$calweek"/>
|
|
</span>
|
|
</xsl:if>
|
|
|
|
<span class="day" title="{$ddate}"
|
|
id="calendar-{date:year($date)}-{date:month-in-year($date)}-{date:day-in-month($date)}">
|
|
<xsl:value-of select="date:day-in-month($date)"/>
|
|
</span>
|
|
|
|
<ul>
|
|
<xsl:variable name="dholiday">
|
|
<xsl:call-template name="ddate-holiday">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
<li><xsl:value-of select="normalize-space($dholiday)"/></li>
|
|
|
|
<xsl:for-each select="event">
|
|
<xsl:sort select="start"/>
|
|
|
|
<xsl:variable name="start">
|
|
<xsl:call-template name="strip-time-from-date">
|
|
<xsl:with-param name="date" select="start"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
<xsl:variable name="end">
|
|
<xsl:call-template name="strip-time-from-date">
|
|
<xsl:with-param name="date" select="end"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
<xsl:variable name="date">
|
|
<xsl:call-template name="strip-time-from-date">
|
|
<xsl:with-param name="date" select="$date"/>
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="(date:seconds($start) <= date:seconds($date))
|
|
and (date:seconds($date) <= date:seconds($end))">
|
|
<li>
|
|
<a>
|
|
<!-- a/@href -->
|
|
<xsl:if test="string-length(link) > 0">
|
|
<xsl:attribute name="href">
|
|
<xsl:call-template name="make-href">
|
|
<xsl:with-param name="href" select="link"/>
|
|
</xsl:call-template>
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<!-- a/@title -->
|
|
<xsl:attribute name="title">
|
|
<xsl:if test="string-length(location) > 0">
|
|
<xsl:value-of select="concat('Ort: ', location,'
')"/>
|
|
</xsl:if>
|
|
<!-- sometimes things dont have a place to happen
|
|
<xsl:if test="string-length(location) = 0">
|
|
<xsl:value-of select="concat('Ort: ', 'GCHQ, Lingnerallee 3, 01069 Dresden')"/>
|
|
</xsl:if>
|
|
-->
|
|
<xsl:if test="string-length(date:time(start)) > 0 or string-length(date:time(end)) > 0">
|
|
<xsl:if test="date:day-in-month($date) = date:day-in-month(start) or date:day-in-month($date) = date:day-in-month(end)">
|
|
<xsl:value-of select="concat('', 'Zeit:')" disable-output-escaping="yes"/>
|
|
<xsl:if test="date:day-in-month($date) = date:day-in-month(start) and string-length(date:time(start)) > 0 and substring(date:time(start),1,5) != ''">
|
|
<xsl:value-of select="concat(' ab ', substring(date:time(start),1,5))"/>
|
|
</xsl:if>
|
|
<xsl:if test="date:day-in-month($date) = date:day-in-month(end) and string-length(date:time(end)) > 0 and substring(date:time(end),1,5) != '' and substring(date:time(end),1,5) != substring(date:time(start),1,5)">
|
|
<xsl:value-of select="concat(' bis ', substring(date:time(end),1,5))"/>
|
|
</xsl:if>
|
|
</xsl:if>
|
|
</xsl:if>
|
|
</xsl:attribute>
|
|
<!-- string(a) -->
|
|
<xsl:value-of select="title"/>
|
|
</a>
|
|
</li>
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
|
|
</ul>
|
|
</td>
|
|
<xsl:if test="date:day-in-week($date) != 1"> <!-- Sunday? Break and return to output-week... -->
|
|
<xsl:call-template name="output-day">
|
|
<xsl:with-param name="date" select="date:add($date, 'P1D')"/>
|
|
</xsl:call-template>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="calendar-title">
|
|
<xsl:variable name="d1" select="date:date()"/>
|
|
<xsl:variable name="d2" select="date:add(date:date(), 'P1M')"/>
|
|
|
|
<xsl:text>Kalender: </xsl:text>
|
|
|
|
<xsl:call-template name="get-monthstring">
|
|
<xsl:with-param name="date" select="$d1"/>
|
|
</xsl:call-template>
|
|
|
|
<xsl:if test="date:year($d1) != date:year($d2)">
|
|
<xsl:text> </xsl:text>
|
|
<xsl:value-of select="date:year($d1)"/>
|
|
</xsl:if>
|
|
|
|
<xsl:text> & </xsl:text>
|
|
|
|
<xsl:call-template name="get-monthstring">
|
|
<xsl:with-param name="date" select="$d2"/>
|
|
</xsl:call-template>
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
<xsl:value-of select="date:year($d2)"/>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="get-past-monday">
|
|
<xsl:param name="date"/>
|
|
<xsl:choose>
|
|
<xsl:when test="date:day-in-week($date) = 2">
|
|
<xsl:value-of select="$date"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:call-template name="get-past-monday">
|
|
<xsl:with-param name="date" select="date:add($date, '-P1D')"/>
|
|
</xsl:call-template>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|