Subject: [xsl] date manipulation From: James Cummings <James.Cummings@xxxxxxxxxxxxxx> Date: Sun, 4 Apr 2004 00:29:42 +0100 (BST) |
Hi there. I've been using XSLT to muck about with listings generated by the xmltv package. To quote from the documentation in its DTD: "All dates and times in this DTD follow the same format, loosely based on ISO 8601. They can be 'YYYYMMDDhhmmss' or some initial substring, for example if you only know the year and month you can have 'YYYYMM'. You can also append a timezone to the end; if no explicit timezone is given, UTC is assumed. Examples: '200007281733 BST', '200209', '19880523083000 +0300'. (BST == +0100.)" Any suggestions what the best way to process this kind of string? I've looked at the FAQ and the examples there are mostly substring based. While this is good for those cases where the entire string is present, how should I trap this when the entire string isn't present, or contains a timezone set of characters (and deal with those?)? To be honest, my source files so far all have it in "20040414130500 +0100" format, but since the DTD comments mention that the string need not be complete, or can contain timezone references, I thought I should be a bit more rigorous than just answering my own needs. My first attempt has been to just us substring to break it up, and on the hour-minute string, add on whatever follows a + if it exists, or test for any (of 3 so far) timezone characters. But this just seems like a lot of fuss. I thought it might be easier to reformat the string to "CCYY-MM-DDThh:mm:ss" and then I could use exslt's format-number. But I still have to worry about +0300 or timezones or such on the end. Suggestions for the best way to proceed? -James --- Dr James Cummings, Oxford Text Archive, University of Oxford James.Cummings at ota.ahds.ac.uk http://users.ox.ac.uk/~jamesc/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: How to specify document o, Dimitre Novatchev | Thread | [xsl] XSL Template Designer V1.0 re, Kazumi Hara |
RE: [xsl] How to put space between , Tuan Luu | Date | Re: [xsl] xml/xsl character escapin, Julian Reschke |
Month |