Archive for March, 2005

XSLT Cookbook: Generating an RFC 822 Date

You want to generate an RFC 822-formatted date in XSLT. This is needed, for example, in RSS feeds.

Use this code:

<xsl:value-of select="concat(date:day-abbreviation(), ', ', 
  format-number(date:day-in-month(), '00'), ' ', 
  date:month-abbreviation(), ' ', date:year(), ' ', 
  format-number(date:hour-in-day(), '00'), ':', 
  format-number(date:minute-in-hour(), '00'), ':', 
  format-number(date:second-in-minute(), '00'), ' GMT')"/>

This assumes your server is in GMT.

XSL uses a different default date format style than RSS, so it’s a bit of a pain to generate the current date in the RFC 822 format.

This code requires the use of the EXSLT date functions. Add them to your stylesheet by modifying the top to look like this:

<xsl:stylesheet xmlns:xsl="" 

I use the format-number() function to make sure all numbers have leading 0s. The date functions return 3 instead of 03, for example.

Yahoo! Search Web Services

Yahoo! Search has just launched a Web service:

You can search five databases: web, local, news, image, and video.

It’s completely free to use for all personal and non-commercial projects and it’s totally REST-based. No SOAP.

There’s an SDK. It’s released as open source under the BSD license.

There are examples in all the major languages: Java, JavaScript, Perl, PHP, and Python.

They’re hosting applications on a Wiki:

So far, there’s a Firefox Sidebar and an Image search application.

More links and information: