I'm writing XSLT to transform an XML document from one DTD to another and in the process of doing so trying to tidy up some date strings.
Each record in my source document has a date element that contains a string representation of a date. Some illustrative examples:
- 11 April 1995
- 14th April 1995
- 10 Sept 2002
- 14 Sep 2004
- 21-23 June 2002
- 2005
I want my resulting document to contain dates (or date ranges where appropriate) in ISO 8601 format.
What's my best strategy for achieving this? I could knuckle down and start writing a function to convert them (probably based on regexes) but I find it hard to believe someone hasn't solved this problem already.
Is there an XSLT module/function out there that will do most of the work for me? Should I be looking outside XSLT for a solution?