innerjoin |
|
| innerjoin | iCalendar | |
Using Mozilla? Downloaded the calendar extension? Want to export events in XML format? or create calendars which can be published on the web and imported?
These notes are written round Calendar 0.8 with Mozilla 1.1, the stable release as of September 2002, on a Linux client
Note that Mozilla Calendar's capability to import/export XML format iCal files was not carried over to Sunbird.
Mozilla Calendar maintains clear distinctions between publishing, subscribing, exporting and importing data.
Mozilla Calendar and Sunbird have a option for exporting the calendar data, the Firefox Calendar extension does not seem to have one.
.ics file, XML as .xcs or RDF formats
The difference for the user is that, if they subscribe to a published calendar, if the source data changes then they see the results of the change, if they have imported an event however there is no reference back to the original source.
Mozilla Calendar's native format is iCalendar (see 'the source',
RFC 2445, or a
cross-referenced subset of the file format)
These are conventionally held as .ics files.
Information about events can however be exported (in the Mozilla Calendar) in several formats,
iCal to .ics files, xCal to .xcs, RDF and CSV.
A test event in the iCalendar format might look like:
See the index of test cases for .ics and .xcs examples and the test data, moz-0-8/ical.ics as text/calendar to allow you to subscribe, or text/plain.
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//innerjoin.org//NONSGML Innerjoin Events Publisher V1.0//EN
BEGIN:VEVENT
UID:200201012-8560@innerjoin.org
DTSTART;VALUE=DATE:20020923
DTSTAMP;VALUE=DATE:20020630
URL:
http://www.somewhere.net/sometestpage.html
SUMMARY:
some test summary
DESCRIPTION:
some test description
END:VEVENT
END:VCALENDER
<?xml version="1.0" encoding="UTF-8"?>
<iCalendar>
<vcalendar>
<prodid>-//Mozilla.org/NONSGML Mozilla Calendar V 1.0 //EN</prodid>
<version>2.0</version>
<vevent>
<uid>200201012-8560@somewhere.net</uid>
<summary>some test summary</summary>
<dtstamp>20020629T220000Z</dtstamp>
<dtstart value="DATE">20020923</dtstart>
<description>some test description</description>
<url>http://www.somewhere.net/sometestpage.html</url>
</vevent>
</vcalendar>
</iCalendar>
moz-0-8/xcal.xcs as text/xml, download the file in Mozilla and use View Source to see the structure or see the text/plain version.
Internet Explorer and Mozilla 1.2 will display the XML using a default style which allows you to explore the data.
The xcal format is not related to xcal (a calendar application for X)
.xcs files are given a text/xml MIME
type by the webserver, Mozilla will treat them as 'well formed' XML documents
(see moz-0-8/xcal.xcs).
The idea is that there is nothing new in the xCalendar format, the data is just wrapped up in a different fashion to let XML tools handle it.
There are two main criteria for exporting and importing data:
Mozilla Calendar is not able to subscribe to xCal (calsch archive) data. Mozilla Calendar 0.8 crashes when subscribing, you have to import the data into your personal calendar
If you export an event in xCal format which includes a URL attribute from Mozilla, the URL is exported as a string:
<url>http://www.somewhere.net/somepage.html</url>
The xCal draft spec (calsch archive) does not show URL's as strings, where they give examples they follow a far more formal route and define the URL as an ENTITY:
<!DOCTYPE iCalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"
"http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-02.txt"[
<!ENTITY ref-20021012-5961 SYSTEM "http://www.somewhere.net/sometestpage.html" NDATA HTML>
]>
moz-0-8/xcal-url-entity.xcs as text/xml and use view source to see the parsed data, or text/plain
<url uri="ref-20021012-5961"/>
The issues are:
It is possible to transform the exported .xcs file,
as it is XML, so it can be displayed in a browser. This can
be done on the
client or
server.
The transformation can, theoretically at least, be done at the client. This means that the browser downloads the XML, downloads the code to transform it (some XSL code) and does the conversion itself. Typically the XML data is converted to XHTML so that a browser can render it. Of course this means that you are prepared to target your pages at the subset of browsers which understand XML and can apply XSL transforms.
You tell the browser about the XSL by adding a separate line, a
xml-stylesheet directive, to the .xcs file which
says which .xsl file to use:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xcs-mozilla.xsl"?>
<iCalendar>
This is xml-stylesheet not xml:stylesheet.
The latter was from an earlier draft but some of the tutorials on the web
still refer to it.
If you want to serve your calendar as HTML from the server and not depend on the browser to do the conversion you need an application on the server to do the transformation work.
With
Apache /
Tomcat /
Cocoon
this is straightforward, or it is straightforward
once you have Tomcat and Cocoon running and configured. You still include extra lines
in the .xcs file, this time for Cocoon to recognise:
<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="xcs-cocoon.xsl"?>
<iCalendar>
The server then takes the XML, follows the instructions in the .xsl file
and serves HTML.
Note that both these options depend on an editing step to add the xml-stylesheet
directive to the .xcs file.
The difficult step is, of course, writing the XSL transform.