[xsl] Document function with Sablotron and timestamp conversion

Subject: [xsl] Document function with Sablotron and timestamp conversion
From: "Mihir" <riffola@xxxxxxxxxxx>
Date: Mon, 28 Feb 2005 12:24:27 -0500

I am having a hard time converting unix timestamp to regular date and time.
I managed to convert the time in the original XML file's hexadecimal format
to decimal unix timestamp, and then I tried using brute force to convert the
seconds into regular time but I hit a snag, I need to display the time in
EST but the timestamp is in GMT. So brute force is way too complicated to
adjust the date difference when it occurs.

So instead I opted to use the document function
I used... <xsl:value-of select="document(concat('timeconvert.php?hex=',
tivo:Details/tivo:CaptureDate)/time)" /> but Sablotron doesn't like it and
says it can't open the file even though timeconvert.php is in the same
folder as the XSL and xml files. The timeconvert.php returns <time>[Human
readable time]</time>

Warning: Sablotron error on line 1: cannot open file
'/home/riffola/public_html/tivo/timeconvert.php?hex=0x422226BE' in
/home/riffola/public_html/tivo/index.php on line 4

Where index.php is just a short script that asks PHP to parse nowplaying.xml
with nowplaying.xsl using Sablotron.

Is there a sure fire way to convert time such as 0x4220AB0E into human
readable form with Sablotron and PHP? Worse case I guess I could go into the
XML file and convert all timestamps before parsing with XSL.

-- Mihir

Current Thread