I’m looking for assistance in importing events from an XML file into Google Calendar. The XML file contains details about workshops that are regularly updated by a different person. My goal is to have Google Calendar update these events automatically without needing to manually upload the file each time.
Here’s an example of what my XML data looks like:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="calendar.xsl"?>
<workshops>
<modified>20150820</modified>
<workshop>
<presenter>N. Tesla</presenter>
<venue>Vienna</venue>
<eventdate>20150715</eventdate>
<starttime>14:30:00</starttime>
<institution>MIT</institution>
<details>
<topic>Wireless Power Transmission in Modern Applications</topic>
<description>Details will be provided later.</description>
</details>
</workshop>
</workshops>
I have designed an XSL stylesheet that transforms this XML into iCal format:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" media-type="text/calendar"/>
<xsl:variable name="newline"> </xsl:variable>
<xsl:template match="/">BEGIN:VCALENDAR<xsl:value-of select="$newline"/>
CALSCALE:GREGORIAN<xsl:value-of select="$newline"/>
VERSION:2.0<xsl:value-of select="$newline"/>
PRODID:-//Workshop Calendar//EN<xsl:value-of select="$newline"/>
X-WR-TIMEZONE:Europe/Vienna<xsl:for-each select="workshops/workshop"><xsl:value-of select="$newline"/>
BEGIN:VEVENT<xsl:value-of select="$newline"/>
LOCATION:<xsl:value-of select="venue"/><xsl:value-of select="$newline"/>
DTSTART:<xsl:value-of select="eventdate"/>T143000<xsl:value-of select="$newline"/>
DTEND:<xsl:value-of select="eventdate"/>T153000<xsl:value-of select="$newline"/>
DESCRIPTION:Workshop by <xsl:value-of select="presenter"/><xsl:value-of select="$newline"/>
SUMMARY:<xsl:value-of select="details/topic"/><xsl:value-of select="$newline"/>
END:VEVENT<xsl:value-of select="$newline"/></xsl:for-each>
END:VCALENDAR<xsl:value-of select="$newline"/>
</xsl:template>
</xsl:stylesheet>
When I run this manually using xsltproc workshops.xml > events.ics and then import the resulting file into Google Calendar, everything works perfectly. The calendar output appears as follows:
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
PRODID:-//Workshop Calendar//EN
X-WR-TIMEZONE:Europe/Vienna
BEGIN:VEVENT
LOCATION:Vienna
DTSTART:20150715T143000
DTEND:20150715T153000
DESCRIPTION:Workshop by N. Tesla
SUMMARY:Wireless Power Transmission in Modern Applications
END:VEVENT
However, Google Calendar cannot process the raw XML file, and I’m uncertain how to set it up so that it updates automatically as the source XML file changes. How can I configure it so that Google Calendar can read the processed calendar file and stay updated with the changes? Additionally, is there a method to change the XSL reference within the original XML file?