xsl/ical: prepend VALUE=DATE to dates without time as per RFC5545

This commit is contained in:
Astro 2016-09-06 20:54:22 +02:00
parent 9cf22a7b68
commit 2dd31fefd7
1 changed files with 26 additions and 12 deletions

View File

@ -80,7 +80,15 @@
</xsl:template>
<xsl:template match="start">
<xsl:text>DTSTART:</xsl:text>
<xsl:choose>
<xsl:when test="contains(., 'T')">
<xsl:text>DTSTART:</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>DTSTART;VALUE=DATE:</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="string(.)"/>
</xsl:call-template>
@ -90,19 +98,25 @@
<xsl:template match="end">
<xsl:choose>
<xsl:when test="not(string(.) = string(../start))">
<xsl:text>DTEND:</xsl:text>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date">
<xsl:choose>
<xsl:when test="contains(., 'T')">
<xsl:choose>
<xsl:when test="contains(., 'T')">
<xsl:text>DTEND:</xsl:text>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date">
<xsl:value-of select="string(.)"/>
</xsl:when>
<xsl:otherwise>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>DTEND;VALUE=DATE:</xsl:text>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date">
<xsl:value-of select="date:add(., 'P1D')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#13;&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>