identi.ca and twitter OLPC – One Line Per Contact

I’ve been having fun with identi.ca and twitter recently, but some of my contacts, friends, followees, subscriptions (or whatever you want to call them) send many more messages than others. One contact gave a running commentary on his progress up the floors of a building yesterday. Fine, but a bit of a torrent of data.

If someone posts and leaves it for a while, it’s sometimes an explanation of where they’ve gone, so I’d like to check people’s last tweets. I’ve seen some clients do that and it seems there’s a method in the API to do it. The API returns XML, so I’m using XSL to transform it to xhtml (I’ve still not taken the time to learn the XML CSS ways) with the following commands:-

	wget --no-check-certificate -O - https://username:PASSWORD@identi.ca/api/statuses/friends.xml | \
	sed -e '1a\
<?xslt-param name="site" select="identi.ca"?>\
<?xml-stylesheet title="Site Summaries" type="text/xsl" href="twitters.xsl" ?>
' > identica.xml

And here’s twitters.xsl which converts the downloaded xml to xhtml:-

<?xml version='1.0' ?>
<xsl:stylesheet version="1.0"
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="site">twitter.com</xsl:param>

<xsl:template match="/" xml:space="preserve">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title><xsl:value-of select="$site" /> Friends</title>
<link rel="stylesheet" type="text/css" href="mirrors.css" />
</head><body>
<dl class="statuses">
<xsl:apply-templates />
</dl>
</body></html>
</xsl:template>

<xsl:template match="/users/user" xml:space="preserve"><dt><a href="http://{$site}/{screen_name}"><img src="{profile_image_url}" /><xsl:value-of select="name" /> (<xsl:value-of select="screen_name" />)</a> - <a class="time" href="http://{$site}/{screen_name}/statuses/{status/id}"><xsl:value-of select="status/created_at" /></a></dt><dd><xsl:value-of select="status/text" /></dd>
</xsl:template>
</xsl:stylesheet>

Have fun! (And what have I done wrong?)

This entry was posted in Wordpress and Blogs and tagged , , , , , . Bookmark the permalink.