Guckt mal, was ich kann!
git-svn-id: svn://svn.c3d2.de/c3d2-web/branches/toidinamais_coole_scheisse@56 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
parent
95162fb152
commit
1394692838
169
xsl/xhtml.xsl
169
xsl/xhtml.xsl
|
@ -5,6 +5,107 @@
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
exclude-result-prefixes="xsl rss rdf">
|
exclude-result-prefixes="xsl rss rdf">
|
||||||
|
|
||||||
|
<!-- Hilfsfunktionen für das Ausrechnen -->
|
||||||
|
<xsl:template name="get-year">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Von Astro übersetzt aus
|
||||||
|
#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
|
||||||
|
#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
|
||||||
|
|
||||||
|
while (days < 0 || days >= (__isleap (y) ? 366 : 365))
|
||||||
|
{
|
||||||
|
/* Guess a corrected year, assuming 365 days per year. */
|
||||||
|
long int yg = y + days / 365 - (days % 365 < 0);
|
||||||
|
|
||||||
|
/* Adjust DAYS and Y to match the guessed year. */
|
||||||
|
days -= ((yg - y) * 365
|
||||||
|
+ LEAPS_THRU_END_OF (yg - 1)
|
||||||
|
- LEAPS_THRU_END_OF (y - 1));
|
||||||
|
y = yg;
|
||||||
|
}
|
||||||
|
nach
|
||||||
|
int y(y, days)
|
||||||
|
{
|
||||||
|
if (days < 0 || days >= (__isleap (y) ? 366 : 365))
|
||||||
|
{
|
||||||
|
long int yg = y + days / 365 - (days % 365 < 0);
|
||||||
|
|
||||||
|
days -= ((yg - y) * 365
|
||||||
|
+ LEAPS_THRU_END_OF (yg - 1)
|
||||||
|
- LEAPS_THRU_END_OF (y - 1));
|
||||||
|
|
||||||
|
return(y(yg, days));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return(y);
|
||||||
|
}
|
||||||
|
.
|
||||||
|
Von toidinamai übersetzt nach XSL.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsl:param name="days" select="0"/>
|
||||||
|
<xsl:param name="year" select="0"/>
|
||||||
|
|
||||||
|
<!-- Guess a corrected year, assuming 365 days per year. -->
|
||||||
|
<xsl:variable name="yearguessed">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="days mod 365 < 0">
|
||||||
|
<xsl:value-of select="$year + floor(days div 365) - 1" />
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$year + floor(days div 365)" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<!-- Adjust DAYS and Y to match the guessed year. -->
|
||||||
|
<xsl:variable name="daysadjusted">
|
||||||
|
<xsl:value-of select="(($yearguessed - $year) * 365
|
||||||
|
+ LEAPS_THRU_END_OF (yearguessed - 1)
|
||||||
|
- LEAPS_THRU_END_OF (y - 1) )" />
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="((year) mod 4 = 0 and ((year) mod 100 != 0 or (year) mod 400 = 0))">
|
||||||
|
|
||||||
|
<xsl:choose>
|
||||||
|
|
||||||
|
<xsl:when test="days < 0 or days >= 366">
|
||||||
|
<xsl:call-template name="get-year">
|
||||||
|
<xsl:with-param name="year" select="yearguessed" />
|
||||||
|
<xsl:with-param name="days" select="daysadjusted" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$year" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
|
||||||
|
</xsl:choose>
|
||||||
|
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
<xsl:otherwise>
|
||||||
|
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="days < 0 or days >= 365">
|
||||||
|
<xsl:call-template name="get-year">
|
||||||
|
<xsl:with-param name="year" select="yearguessed" />
|
||||||
|
<xsl:with-param name="days" select="daysadjusted" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$year" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
|
||||||
|
</xsl:otherwise>
|
||||||
|
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:output method="xml"
|
<xsl:output method="xml"
|
||||||
version="1.0"
|
version="1.0"
|
||||||
encoding="utf-8"
|
encoding="utf-8"
|
||||||
|
@ -202,39 +303,55 @@
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<!-- Magie: Datum aus Unix-Timestamp noch Deutsch transformieren... -->
|
<!-- Magie: Datum aus Unix-Timestamp noch Deutsch transformieren... -->
|
||||||
|
<xsl:variable name="date_days">
|
||||||
|
<xsl:value-of select="floor(@date div 604800)" />
|
||||||
|
</xsl:variable>
|
||||||
<xsl:variable name="date_dayofweek">
|
<xsl:variable name="date_dayofweek">
|
||||||
<xsl:value-of select="floor((@date mod 604800) div 86400) + 3 mod 7"/>
|
<xsl:value-of select="4 + $date_days mod 7"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="date_hour">
|
||||||
|
<xsl:value-of select="format-number(floor(@date mod 86400 div 3600), '00')" />
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="date_minute">
|
||||||
|
<xsl:value-of select="format-number(floor(@date mod 3600 div 60), '00')" />
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="date_second">
|
||||||
|
<xsl:value-of select="format-number(floor(@date mod 60), '00')" />
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="date_dayofweekstring">
|
<xsl:variable name="date_dayofweekstring">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$date_dayofweek = 0">
|
<xsl:when test="$date_dayofweek = 0">Montag</xsl:when>
|
||||||
Montag
|
<xsl:when test="$date_dayofweek = 1">Dienstag</xsl:when>
|
||||||
</xsl:when>
|
<xsl:when test="$date_dayofweek = 2">Mittwoch</xsl:when>
|
||||||
<xsl:when test="$date_dayofweek = 1">
|
<xsl:when test="$date_dayofweek = 3">Donnerstag</xsl:when>
|
||||||
Dienstag
|
<xsl:when test="$date_dayofweek = 4">Freitag</xsl:when>
|
||||||
</xsl:when>
|
<xsl:when test="$date_dayofweek = 5">Samstag</xsl:when>
|
||||||
<xsl:when test="$date_dayofweek = 2">
|
<xsl:when test="$date_dayofweek = 6">Sonntag</xsl:when>
|
||||||
Mittwoch
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$date_dayofweek = 3">
|
|
||||||
Donnerstag
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$date_dayofweek = 4">
|
|
||||||
Freitag
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$date_dayofweek = 5">
|
|
||||||
Samstag
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$date_dayofweek = 6">
|
|
||||||
Sonntag
|
|
||||||
</xsl:when>
|
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="date_dayofmonth" />
|
<xsl:variable name="date_dayofmonth">23</xsl:variable>
|
||||||
<xsl:variable name="date_monthstring" />
|
<xsl:variable name="date_month">11</xsl:variable>
|
||||||
<xsl:variable name="date_year" />
|
<xsl:variable name="date_monthstring">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$date_month = 0">Januar</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 1">Februar</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 2">März</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 3">April</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 4">Mai</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 5">Juni</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 6">Juli</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 7">August</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 8">September</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 9">Oktober</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 10">November</xsl:when>
|
||||||
|
<xsl:when test="$date_month = 11">Dezember</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="date_year">
|
||||||
|
<xsl:call-template name="get-year" />
|
||||||
|
</xsl:variable>
|
||||||
<xsl:variable name="datestring">
|
<xsl:variable name="datestring">
|
||||||
<xsl:value-of select="concat($date_dayofweekstring, ', ', $date_dayofmonth, '. ', $date_monthstring, ' ', $date_year)" />
|
<xsl:value-of select="concat($date_dayofweekstring, ', ', $date_dayofmonth, '. ', $date_monthstring, ' ', $date_year, ' um ', $date_hour, ':', $date_minute, ':', $date_second)" />
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:element name="small">
|
<xsl:element name="small">
|
||||||
|
|
Loading…
Reference in New Issue