[Home] [By Thread] [By Date] [Recent Entries]
Jean-Yves Avenard schrieb:
I am working on some xmltv files. An xmltv file (as described in www.xmltv.org) is a XML file containing TV programme information. The programme listings look like this: <tv> <programme channel="tpg.aljazeera" start="20080430040000 +0100" stop="20080430043000 +0100"> [...] I'm working with TV data, too. As you can see, the programme contains one attribute: start which is a date in the format YYYYMMDDHHMMSS [+-]XXXX where XXXX is the timezone.
The way I would convert my date, with my template/function is: <xsl:variable name="utcstart"> <xsl:call-template name="UTCDate"> <xsl:with-param name="DateTime" select="@start"/> </xsl:call-template> </xsl:variable>
-- My UTC convert template: Unfortunately, I want this to run in my web browser, and I haven't found one compatible with XSLT 2.0, so I had to do everything by hand.
And I think we'll have to wait for a couple of years to see widespread support for 2.0 in web browsers. Even on the server side, if you use Perl or PHP or Python, you'll very likely use LibXSLT, which means XSLT 1.0. [ snipped 250+ lines of XSLT ] I haven't checked this XSLT - but it's so much easier in other languages, which have all the functionality you need to handle dates. http://de3.php.net/manual/en/xsltprocessor.registerphpfunctions.php http://search.cpan.org/dist/XML-LibXSLT/LibXSLT.pm - register_function Best, Michael
|

Cart



