This article was imported from this blog's previous content management system (WordPress), and may have errors in formatting and functionality. If you find these errors are a significant barrier to understanding the article, please let me know.
I try to do the “right thing” in postings on DLTJ. In the context of this discussion “right” is an attempt to be progressive: including hCalendar microformat markupfor postings that include mention of events. The latest example of this was yesterday’s posting of the Learning, Libraries and Technology Conference. Embedded in the first paragraph is markup that another application reading the DLTJ feed can use to understand that the posting is talking about an event. (The Technorati Events” service is one example.) The key parts of the HTML are bolded below:
Microformats are small bits of HTML that represent things like people, events, tags, etc. in web pages. Microformats enable the publishing of higher fidelity information on the Web, providing the fastest and simplest way to support feeds and APIs for your website.
The hCalendar microformat is based on the iCalendar file format – a mechanism for calendaring programs to share information about events and meeting requests.
Also included in the posting is a link that says “add this event to your desktop calendar program.” This link uses an XSLT-driven process to transform the microformat data embedded in the XHTML posting into the iCalendar format. The XSLT transformation was written by Brian Suda; Brian also has a transformation service for taking an arbitrary XHTML document with hCalendar markup and creating the corresponding iCalendar file. I’ve used this transformation service in previous postings on DLTJ.
I’ve used this so much that I decided not to sponge on Brian’s translation service any more and create an equivalent translation service that runs on DLTJ. Included below is some PHP code that will drive the XSLT transformation process. If you copy and paste this PHP into a file in the same directory with Brian’s “x2v” implementation, then you can do the same thing.
Here is the script itself:
The text was modified to remove a link to http://hg.microformats.org/ on November 21st, 2012.