Plazes Traces + XSLT = RSS

Peter Rukavina
The code described here has been moved into Subversion.

I did some experimenting this afternoon with taking my Plazes XML Traces file and using XSLT to transform it into RSS. I didn’t end up with a complete solution, but I came close:

The problem I ran into is that in the Traces file dates are represented like this:

<location arrival=”2005-06-10”>

Whereas for the RSS file I need something that looks like this:

<pubDate>Sat, 25 Jun 2005 17:36:08 +0100</pubDate>

I need a way of converting dates from one form to another in pure XSLT. I found references here and here that suggested ways around XSLT’s poor date support, but I haven’t implemented them here. As a result, the resulting RSS file is missing a <pubDate>.

I welcome suggestions on how to improve this.

Update: You can use the W3C web-based XSLT processor to do the transformation: the result is RSS that can be fed to an aggregator or newsreader. The pre-packaged URL is here. To reduce load on their XSLT processor, however, please don’t subscribe to this URL.

Comments

Submitted by Olle Jonsson on

Permalink

Darn. Do we need to ask the Plazes guys to export two date fields? Or, of course, we could mung our way through this whole horrible XSLT-ness.

“There are currently no XSLT processors that we know of that support date:date-format natively.”

“There are currently no third-party implementations of date:date-format.” They said.

Submitted by Olle Jonsson on

Permalink

OK, how about this? First, you grab the XML clump into a PHP string, then you replace all the dates things using this function, and then you output the string as XML with your previous XSLT added.

/**
* Formats date for RSS feeds
*
* @param datetime $date Datetime string
* @return string Formatted date string for RSS feeds
*/
function toRSS ($date) {
return date('D, d M Y H:i:s O', $date);
}

Submitted by Edward Vielmetti on

Permalink

I’m thinking about how to get this to generate some javascript that I can include on a page (in Typepad) to show current location based on Plazes.

The equation looks like Traces + XSLT + Feedburner’s RSS to Javascript. The downside is that Feedburner only polls the RSS every so often and you would like this to be real time or more nearly so. I know it would be easier in PHP, but that’s not my environment right now. Feedburner can keep the auth information private and just expose the rewritten RSS.

Any better suggestions for a little hunk of Javascript that prettyprints your current Plaze, with your login and password suitably hidden through a proxy?

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search