Moving anchor timestamp saving to disconnect code (I think it makes more
[gdataplugin.git] / src / gcal2osync.xslt
blob421d3f79f21fe3b888d490877ba9f34ab24d5e0a
1 <?xml version="1.0" ?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:atom="http://www.w3.org/2005/Atom"
5 xmlns:gd="http://schemas.google.com/g/2005">
7 <xsl:output method="xml" indent="yes"/>
9 <xsl:template match="child::entry">
10 <event>
11 <Comment>
12 <Content>
13 <xsl:value-of select="descendant::atom:content"/>
14 </Content>
15 </Comment>
17 <Contact>
18 <Content>
19 <xsl:value-of select="descendant::atom:author/atom:name"/>
20 </Content>
21 </Contact>
23 <Created>
24 <Content>
25 <xsl:value-of select="descendant::atom:published"/>
26 </Content>
27 </Created>
29 <DateEnd>
30 <Content>
31 <xsl:choose>
32 <xsl:when test="descendant::gd:when/@endTime">
33 <xsl:value-of select="descendant::gd:when/@endTime"/>
34 </xsl:when>
35 <xsl:otherwise>
36 <xsl:variable name="recurrence">
37 <xsl:value-of select="descendant::gd:recurrence"/>
38 </xsl:variable>
40 <xsl:choose>
41 <xsl:when test="substring-after($recurrence,'DTEND;VALUE=DATE:')">
42 <xsl:value-of select="substring-before(substring-after($recurrence, 'DTEND;VALUE=DATE:'),'RRULE:')"/>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:value-of select="substring-after(substring-before(substring-after($recurrence,'DTEND;TZID='),
46 'RRULE:'), ':')"/>
47 </xsl:otherwise>
48 </xsl:choose>
50 </xsl:otherwise>
51 </xsl:choose>
52 </Content>
53 </DateEnd>
55 <DateStarted>
56 <Content>
57 <xsl:choose>
58 <xsl:when test="descendant::gd:when/@startTime">
59 <xsl:value-of select="descendant::gd:when/@startTime"/>
60 </xsl:when>
61 <xsl:otherwise>
62 <!-- TODO: remove trailing empty space... -->
63 <xsl:variable name="recurrence">
64 <xsl:value-of select="descendant::gd:recurrence"/>
65 </xsl:variable>
67 <xsl:choose>
68 <xsl:when test="substring-after($recurrence, 'DTSTART;VALUE=DATE:')">
69 <xsl:value-of select="substring-before(substring-after($recurrence, 'DTSTART;VALUE=DATE:'),'DTEND')"/>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="substring-after(substring-before(substring-after($recurrence,'DTSTART;TZID='),
73 'DTEND;'), ':')"/>
74 </xsl:otherwise>
75 </xsl:choose>
77 </xsl:otherwise>
78 </xsl:choose>
79 </Content>
80 </DateStarted>
82 <Description>
83 <Content>
84 <xsl:value-of select="descendant::atom:title"/>
85 </Content>
86 </Description>
88 <LastModified>
89 <Content>
90 <xsl:value-of select="descendant::atom:updated"/>
91 </Content>
92 </LastModified>
94 <Location>
95 <Content>
96 <xsl:value-of select="descendant::gd:where/@valueString"/>
97 </Content>
98 </Location>
100 <xsl:if test="descendant::gd:recurrence">
101 <RecurrenceRule>
102 <!-- TODO: remove trailing empty space... -->
103 <xsl:variable name="recurrence">
104 <xsl:value-of select="descendant::gd:recurrence"/>
105 </xsl:variable>
107 <Frequency>
108 <xsl:value-of select="substring-before(substring-after($recurrence,
109 'RRULE:FREQ='),';BYDAY=')"/>
110 </Frequency>
111 <Until>
112 <xsl:value-of select="substring-after($recurrence,';UNTIL=')"/>
113 </Until>
114 <ByDay>
115 <xsl:value-of select="substring-before(substring-after($recurrence,
116 ';BYDAY='),';')"/>
117 </ByDay>
118 </RecurrenceRule>
119 </xsl:if>
121 <Status>
122 <Content>
123 <xsl:variable name="status">
124 <xsl:value-of select="descendant::gd:eventStatus/@value"/>
125 </xsl:variable>
126 <xsl:choose>
127 <xsl:when test="substring-after($status, '#event.') =
128 'confirmed'">CONFIRMED</xsl:when>
129 <xsl:otherwise>CANCELLED</xsl:otherwise>
130 </xsl:choose>
131 </Content>
132 </Status>
134 <Uid>
135 <Content>
136 <xsl:value-of select="descendant::atom:id"/>
137 </Content>
138 </Uid>
140 <Url>
141 <Content>
142 <xsl:value-of select="descendant::atom:link[@rel='edit']/@href"/>
143 </Content>
144 </Url>
146 </event>
147 </xsl:template>
150 </xsl:stylesheet>