All Posts Tagged With: "xslt"

Adam’s Fall Conference Schedule

Now that’s I’m back from FOO Camp, I’m checking my calendar to see what conference events I have coming up. For those of you keeping track (hi mom!), here they are:

  • Microsoft PDC: September 13-16 in LA. I haven’t managed to wrangle a chance to speak yet. :)
  • Zend/PHP Conference: October 18-21 in Silicon Valley. Speaking about eBay Web services. Final talk TBD.
  • ApacheCon US 2005: December 10-14 in San Diego. Speaking on “Consuming Web Services Using PHP 5”.

I may also go to Web 2.0 and the 4D Summit, but I have yet to finalize those events.

The ApacheCon talk should be quite cool, as I will be showing off nifty real-world web services examples. For example, sucking RSS bookmarks into a WordPress blog, or mashing up eBay Web services search results with the Google mapping API. Here’s the full abstract:

As we move into the world of Web 2.0, PHP developers must increasing include Web services in their toolkit of skills. This session covers how to implement REST and SOAP clients using the latest PHP 5 extensions, such as ext/soap, SimpleXML, and xsl.

This is not an academic talk discussing theory and specifications. Examples show applications of popular Web services, including, eBay, and Google Maps.

Don’t be left behind. Come to this session and learn how to integrate Web services into your code.

I have most of the code already written in various places, so there’s only the problem of creating the slides. Once I know more about my other talks, I will pimp them here, so stay tuned for all the details.

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.