xsl/common: merge event start & end display, xsl/date: split get-timestring from get-datestring

This commit is contained in:
Astro 2011-07-22 03:31:29 +02:00
parent b5c8d0ff18
commit 4e1a87b80b
2 changed files with 55 additions and 45 deletions

View File

@ -259,49 +259,53 @@
<!-- Support für <event/> bzw. Microformats -->
<xsl:include href="date.xsl" />
<xsl:template match="item/event/start">
<xsl:variable name="date" select="."/>
<xsl:variable name="start" select="."/>
<xsl:variable name="end" select="../end"/>
<dl>
<dt>
<xsl:choose>
<xsl:when test="../end">Beginn</xsl:when>
<xsl:otherwise>Datum</xsl:otherwise>
</xsl:choose>
</dt>
<dt>Datum</dt>
<dd>
<abbr class="dtstart">
<xsl:attribute name="title">
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="$date"/>
<xsl:with-param name="date" select="$start"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="$date"/>
<xsl:with-param name="date" select="$start"/>
</xsl:call-template>
</abbr>
<xsl:if test="$end">
bis
<abbr class="dtend">
<xsl:attribute name="title">
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="$end"/>
</xsl:call-template>
</xsl:attribute>
<xsl:choose>
<!-- Ends on same day it starts? -->
<xsl:when test="date:date($start) = date:date($end)">
<xsl:call-template name="get-timestring">
<xsl:with-param name="date" select="$end"/>
</xsl:call-template>
</xsl:when>
<!-- Event spans days -->
<xsl:otherwise>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="$end"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</abbr>
</xsl:if>
</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>
<!-- Output already for item/event/start above -->
</xsl:template>
<xsl:template match="item/event/location">
<dl>

View File

@ -338,28 +338,34 @@
<!-- Uhrzeit optional, im Timestamp einfach alles ab T... weglassen -->
<xsl:if test="date:hour-in-day($date)">
<xsl:text> um </xsl:text>
<xsl:variable name="hour_in_day">
<xsl:if test="string-length(date:hour-in-day($date))=1">0</xsl:if>
<xsl:value-of select="date:hour-in-day($date)"/>
</xsl:variable>
<xsl:variable name="minute_in_hour">
<xsl:if test="string-length(date:minute-in-hour($date))=1">0</xsl:if>
<xsl:value-of select="date:minute-in-hour($date)"/>
</xsl:variable>
<xsl:variable name="second_in_minute">
<xsl:if test="string-length(date:second-in-minute($date))=1">0</xsl:if>
<xsl:value-of select="date:second-in-minute($date)"/>
</xsl:variable>
<xsl:value-of select="$hour_in_day"/>:<xsl:value-of select="$minute_in_hour"/>
<xsl:text> Uhr</xsl:text>
<xsl:call-template name="get-timestring">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="get-timestring">
<xsl:param name="date"/>
<xsl:variable name="hour_in_day">
<xsl:if test="string-length(date:hour-in-day($date))=1">0</xsl:if>
<xsl:value-of select="date:hour-in-day($date)"/>
</xsl:variable>
<xsl:variable name="minute_in_hour">
<xsl:if test="string-length(date:minute-in-hour($date))=1">0</xsl:if>
<xsl:value-of select="date:minute-in-hour($date)"/>
</xsl:variable>
<xsl:variable name="second_in_minute">
<xsl:if test="string-length(date:second-in-minute($date))=1">0</xsl:if>
<xsl:value-of select="date:second-in-minute($date)"/>
</xsl:variable>
<xsl:value-of select="$hour_in_day"/>:<xsl:value-of select="$minute_in_hour"/>
<xsl:text> Uhr</xsl:text>
</xsl:template>
<xsl:template name="get-short-datestring">
<xsl:param name="date"/>