Datumscode in eigene Datei.
git-svn-id: svn://svn.c3d2.de/c3d2-web/branches/toidinamais_coole_scheisse@67 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
parent
2eb1b800d1
commit
52b7804dad
|
@ -0,0 +1,353 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:rss="http://purl.org/rss/1.0/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
exclude-result-prefixes="xsl rss rdf">
|
||||
|
||||
<xsl:template name="isleap">
|
||||
<xsl:param name="year" />
|
||||
|
||||
<xsl:value-of select="$year mod 4 = 0 and ($year mod 100 != 0 or $year mod 400 = 0)" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="leapdays">
|
||||
<!-- Berechnet die Schalttage, die bis $year seit 1970 vergangen sind -->
|
||||
<xsl:param name="year" />
|
||||
|
||||
<xsl:variable name="four">
|
||||
<xsl:value-of select="floor($year div 4)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="hundred">
|
||||
<xsl:value-of select="floor($year div 100)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="fourhundred">
|
||||
<xsl:value-of select="floor($year div 400)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="$four - $hundred + $fourhundred - 477" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="correct-seconds">
|
||||
<!-- Berechnet die Sekunden die vergangen wären, wenn es keine Schaltjahre gäbe -->
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="yearguessed">
|
||||
<xsl:value-of select="floor($seconds div (86400 * 365)) + 1970" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="leapdays">
|
||||
<xsl:call-template name="leapdays">
|
||||
<xsl:with-param name="year" select="$yearguessed" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:value-of select="$seconds - $leapdays * 86400" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:value-of select="floor($secondscorrected div (86400 * 365)) + 1970" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:value-of select="floor(($secondscorrected div 86400) mod 365) + 1" />
|
||||
</xsl:variable>
|
||||
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap">
|
||||
<xsl:value-of select="$secondscorrected + 86400" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$secondscorrected" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-days">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:call-template name="correct-seconds">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="floor(($secondscorrected mod (365 * 86400)) div 86400) + 1" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-year">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:call-template name="correct-seconds">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="1970 + floor($secondscorrected div (86400 * 365))" />
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-month">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="febdays">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap = 'true'">
|
||||
<xsl:value-of select="29" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="28" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:call-template name="get-days">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$days <= 31">
|
||||
<xsl:value-of select="1" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays">
|
||||
<xsl:value-of select="2" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31">
|
||||
<xsl:value-of select="3" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30">
|
||||
<xsl:value-of select="4" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31">
|
||||
<xsl:value-of select="5" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="6" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="7" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31">
|
||||
<xsl:value-of select="8" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30">
|
||||
<xsl:value-of select="9" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31">
|
||||
<xsl:value-of select="10" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="11" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="12" />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofmonth">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="febdays">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap = 'true'">
|
||||
<xsl:value-of select="29" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="28" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:call-template name="get-days">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$days <= 31">
|
||||
<xsl:value-of select="$days" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays">
|
||||
<xsl:value-of select="$days - 31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31">
|
||||
<xsl:value-of select="$days - 31 + $febdays + 31 + 30 + 31 + 30 + 31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofweek">
|
||||
<!-- 1 entspricht Montag -->
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<!-- 1. Januar 1970 war ein Donnerstag -->
|
||||
<xsl:value-of select="(floor($seconds div 86400) + 3) mod 7 + 1" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofweekstring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="dayofweek">
|
||||
<xsl:call-template name="get-dayofweek">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dayofweek = 1">Montag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 2">Dienstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 3">Mittwoch</xsl:when>
|
||||
<xsl:when test="$dayofweek = 4">Donnerstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 5">Freitag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 6">Samstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 7">Sonntag</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-timestring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="hour">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 86400 div 3600), '00')" />
|
||||
</xsl:variable>
|
||||
<xsl:variable name="minute">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 3600 div 60), '00')" />
|
||||
</xsl:variable>
|
||||
<xsl:variable name="second">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 60), '00')" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="concat($hour, ':', $minute, ':', $second)" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-monthstring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="month">
|
||||
<xsl:call-template name="get-month">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$month = 1">Januar</xsl:when>
|
||||
<xsl:when test="$month = 2">Februar</xsl:when>
|
||||
<xsl:when test="$month = 3">März</xsl:when>
|
||||
<xsl:when test="$month = 4">April</xsl:when>
|
||||
<xsl:when test="$month = 5">Mai</xsl:when>
|
||||
<xsl:when test="$month = 6">Juni</xsl:when>
|
||||
<xsl:when test="$month = 7">Juli</xsl:when>
|
||||
<xsl:when test="$month = 8">August</xsl:when>
|
||||
<xsl:when test="$month = 9">September</xsl:when>
|
||||
<xsl:when test="$month = 10">Oktober</xsl:when>
|
||||
<xsl:when test="$month = 11">November</xsl:when>
|
||||
<xsl:when test="$month = 12">Dezember</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-datestring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="monthstring">
|
||||
<xsl:call-template name="get-monthstring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="dayofmonth">
|
||||
<xsl:call-template name="get-dayofmonth">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="dayofweekstring">
|
||||
<xsl:call-template name="get-dayofweekstring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="timestring">
|
||||
<xsl:call-template name="get-timestring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="concat($dayofweekstring, ', ', $dayofmonth, '. ', $monthstring, ' ', $year, ' um ', $timestring)" />
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
412
xsl/xhtml.xsl
412
xsl/xhtml.xsl
|
@ -5,417 +5,7 @@
|
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
exclude-result-prefixes="xsl rss rdf">
|
||||
|
||||
<xsl:template name="numdays">
|
||||
<!-- Gibt Anzahl der Tage in einem Jahr oder in einem Monat zurück -->
|
||||
<xsl:param name="year" />
|
||||
<xsl:param name="month" select="'undefined'" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$month = 'undefined'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(($year) mod 4 = 0 and (($year) mod 100 != 0 or ($year) mod 400 = 0))">
|
||||
<xsl:value-of select="366" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="365" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 1">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 2">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(($year) mod 4 = 0 and (($year) mod 100 != 0 or ($year) mod 400 = 0))">
|
||||
<xsl:value-of select="29" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="28" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 3">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 4">
|
||||
<xsl:value-of select="30" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 5">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 6">
|
||||
<xsl:value-of select="30" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 7">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 8">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 9">
|
||||
<xsl:value-of select="30" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 10">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 11">
|
||||
<xsl:value-of select="30" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$month = 12">
|
||||
<xsl:value-of select="31" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>
|
||||
Ungültiger Monat: <xsl:value-of select="$month" />
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="isleap">
|
||||
<xsl:param name="year" />
|
||||
|
||||
<xsl:value-of select="$year mod 4 = 0 and ($year mod 100 != 0 or $year mod 400 = 0)" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="leapdays">
|
||||
<!-- Berechnet die Schalttage, die bis $year seit 1970 vergangen sind -->
|
||||
<xsl:param name="year" />
|
||||
|
||||
<xsl:variable name="four">
|
||||
<xsl:value-of select="floor($year div 4)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="hundred">
|
||||
<xsl:value-of select="floor($year div 100)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="fourhundred">
|
||||
<xsl:value-of select="floor($year div 400)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="$four - $hundred + $fourhundred - 477" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="correct-seconds">
|
||||
<!-- Berechnet die Sekunden die vergangen wären, wenn es keine Schaltjahre gäbe -->
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="yearguessed">
|
||||
<xsl:value-of select="floor($seconds div (86400 * 365)) + 1970" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="leapdays">
|
||||
<xsl:call-template name="leapdays">
|
||||
<xsl:with-param name="year" select="$yearguessed" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:value-of select="$seconds - $leapdays * 86400" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:value-of select="floor($secondscorrected div (86400 * 365)) + 1970" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:value-of select="floor(($secondscorrected div 86400) mod 365) + 1" />
|
||||
</xsl:variable>
|
||||
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap">
|
||||
<xsl:value-of select="$secondscorrected + 86400" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$secondscorrected" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-days">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:call-template name="correct-seconds">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="floor(($secondscorrected mod (365 * 86400)) div 86400) + 1" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-year">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="secondscorrected">
|
||||
<xsl:call-template name="correct-seconds">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="1970 + floor($secondscorrected div (86400 * 365))" />
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-month">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="febdays">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap = 'true'">
|
||||
<xsl:value-of select="29" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="28" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:call-template name="get-days">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$days <= 31">
|
||||
<xsl:value-of select="1" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays">
|
||||
<xsl:value-of select="2" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31">
|
||||
<xsl:value-of select="3" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30">
|
||||
<xsl:value-of select="4" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31">
|
||||
<xsl:value-of select="5" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="6" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="7" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31">
|
||||
<xsl:value-of select="8" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30">
|
||||
<xsl:value-of select="9" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31">
|
||||
<xsl:value-of select="10" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="11" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="12" />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofmonth">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="isleap">
|
||||
<xsl:call-template name="isleap">
|
||||
<xsl:with-param name="year" select="$year" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="febdays">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$isleap = 'true'">
|
||||
<xsl:value-of select="29" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="28" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="days">
|
||||
<xsl:call-template name="get-days">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$days <= 31">
|
||||
<xsl:value-of select="$days" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays">
|
||||
<xsl:value-of select="$days - 31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31">
|
||||
<xsl:value-of select="$days - 31 + $febdays + 31 + 30 + 31 + 30 + 31" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$days <= 31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31">
|
||||
<xsl:value-of select="$days - (31 + $febdays + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30)" />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofweek">
|
||||
<!-- 1 entspricht Montag -->
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<!-- 1. Januar 1970 war ein Donnerstag -->
|
||||
<xsl:value-of select="(floor($seconds div 86400) + 3) mod 7 + 1" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-dayofweekstring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="dayofweek">
|
||||
<xsl:call-template name="get-dayofweek">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dayofweek = 1">Montag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 2">Dienstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 3">Mittwoch</xsl:when>
|
||||
<xsl:when test="$dayofweek = 4">Donnerstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 5">Freitag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 6">Samstag</xsl:when>
|
||||
<xsl:when test="$dayofweek = 7">Sonntag</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-timestring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="hour">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 86400 div 3600), '00')" />
|
||||
</xsl:variable>
|
||||
<xsl:variable name="minute">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 3600 div 60), '00')" />
|
||||
</xsl:variable>
|
||||
<xsl:variable name="second">
|
||||
<xsl:value-of select="format-number(floor($seconds mod 60), '00')" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="concat($hour, ':', $minute, ':', $second)" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-monthstring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="month">
|
||||
<xsl:call-template name="get-month">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$month = 1">Januar</xsl:when>
|
||||
<xsl:when test="$month = 2">Februar</xsl:when>
|
||||
<xsl:when test="$month = 3">März</xsl:when>
|
||||
<xsl:when test="$month = 4">April</xsl:when>
|
||||
<xsl:when test="$month = 5">Mai</xsl:when>
|
||||
<xsl:when test="$month = 6">Juni</xsl:when>
|
||||
<xsl:when test="$month = 7">Juli</xsl:when>
|
||||
<xsl:when test="$month = 8">August</xsl:when>
|
||||
<xsl:when test="$month = 9">September</xsl:when>
|
||||
<xsl:when test="$month = 10">Oktober</xsl:when>
|
||||
<xsl:when test="$month = 11">November</xsl:when>
|
||||
<xsl:when test="$month = 12">Dezember</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-datestring">
|
||||
<xsl:param name="seconds" />
|
||||
|
||||
<xsl:variable name="year">
|
||||
<xsl:call-template name="get-year">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="monthstring">
|
||||
<xsl:call-template name="get-monthstring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="dayofmonth">
|
||||
<xsl:call-template name="get-dayofmonth">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="dayofweekstring">
|
||||
<xsl:call-template name="get-dayofweekstring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="timestring">
|
||||
<xsl:call-template name="get-timestring">
|
||||
<xsl:with-param name="seconds" select="$seconds" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="concat($dayofweekstring, ', ', $dayofmonth, '. ', $monthstring, ' ', $year, ' um ', $timestring)" />
|
||||
|
||||
</xsl:template>
|
||||
<xsl:include href="date.xsl" />
|
||||
|
||||
<xsl:output method="xml"
|
||||
version="1.0"
|
||||
|
|
Loading…
Reference in New Issue