Updated contact's get_changes with the working changes for calendar's function
[opensync/google-calendar-cdf.git] / src / osync2gcont.xslt
blobb1436f684e8b4568f537fcc2c75ffe2c24084230
1 <?xml version="1.0" ?>
2 <xsl:stylesheet version="1.0"
3 xmlns="http://www.w3.org/2005/Atom"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:gd="http://schemas.google.com/g/2005">
7 <xsl:output method="xml" indent="yes"/>
9 <xsl:template match="child::contact">
10 <entry>
12 <!-- <id> -->
13 <!-- <xsl:value-of select="descendant::Uid/Content"/> -->
14 <!-- </id> -->
16 <!-- <updated> -->
17 <!-- <xsl:value-of select="descendant::Revision/Content"/> -->
18 <!-- </updated> -->
20 <category>
21 <xsl:attribute name="scheme">http://schemas.google.com/g/2005#kind</xsl:attribute>
22 <xsl:attribute name="term">http://schemas.google.com/contact/2008#contact</xsl:attribute>
23 </category>
25 <title>
26 <xsl:attribute name="type">text</xsl:attribute>
27 <xsl:choose>
28 <xsl:when test="descendant::FormattedName/Content"><xsl:value-of select="descendant::FormattedName/Content"/></xsl:when>
29 <xsl:otherwise><xsl:value-of select="concat(descendant::Name/FirstName,
30 ' ', descendant::Name/LastName)"/></xsl:otherwise>
31 </xsl:choose>
32 </title>
34 <content><xsl:attribute name="type">text</xsl:attribute>
35 <xsl:value-of select="descendant::Title/Content"/>
36 </content>
38 <!-- <link> -->
39 <!-- <xsl:attribute name="rel">edit</xsl:attribute> -->
40 <!-- <xsl:attribute name="type">application/atom+xml</xsl:attribute> -->
41 <!-- <xsl:attribute name="href"> -->
42 <!-- <xsl:value-of select="descendant::Url/Content"/> -->
43 <!-- </xsl:attribute> -->
44 <!-- </link> -->
46 <!-- TODO: handle type of email attribute -->
47 <gd:email>
48 <xsl:attribute name="rel">http://schemas.google.com/g/2005#other</xsl:attribute>
49 <xsl:attribute name="address">
50 <xsl:value-of select="descendant::EMail/Content"/>
51 </xsl:attribute>
52 </gd:email>
55 <!-- TODO: add IM elements here -->
58 <!-- TODO: label attributes -->
59 <xsl:for-each select="descendant::Address">
60 <gd:postalAddress>
61 <xsl:attribute name="rel">http://schemas.google.com/g/2005#other</xsl:attribute>
63 <xsl:value-of select="."/>
64 </gd:postalAddress>
65 </xsl:for-each>
67 <xsl:for-each select="descendant::Telephone">
68 <gd:phoneNumber>
70 <xsl:if test="./@Type = 'Cellular'">
71 <xsl:attribute name="rel">http://schemas.google.com/g/2005#mobile</xsl:attribute>
72 <xsl:value-of select="./Content"/>
73 </xsl:if>
75 <xsl:if test="./@Type = 'Voice'">
76 <xsl:attribute name="rel">http://schemas.google.com/g/2005#home</xsl:attribute>
77 <xsl:value-of select="./Content"/>
78 </xsl:if>
80 <xsl:if test="./@Type = 'Fax'">
81 <xsl:attribute name="rel">http://schemas.google.com/g/2005#work_fax</xsl:attribute>
82 <xsl:value-of select="./Content"/>
83 </xsl:if>
85 <xsl:if test="./@Type = 'Pager'">
86 <xsl:attribute name="rel">http://schemas.google.com/g/2005#pager</xsl:attribute>
87 <xsl:value-of select="./Content"/>
88 </xsl:if>
90 <xsl:if test="./@Type = 'Company'">
91 <xsl:attribute name="rel">http://schemas.google.com/g/2005#work</xsl:attribute>
92 <xsl:value-of select="./Content"/>
93 </xsl:if>
95 <xsl:if test="./@Type = 'Message'">
96 <xsl:attribute name="rel">http://schemas.google.com/g/2005#other</xsl:attribute>
97 <xsl:value-of select="./Content"/>
98 </xsl:if>
100 </gd:phoneNumber>
101 </xsl:for-each>
102 </entry>
104 </xsl:template>
107 </xsl:stylesheet>