RE: [xsl] Performance Loss by dateTime conversion?

Subject: RE: [xsl] Performance Loss by dateTime conversion?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 16 Mar 2007 23:43:07 -0000
> I have a performance issue concerning the conversion from C's 
> time_t (seconds since 00:00:00 GMT Jan. 1,
> 1970) to a date time string like CCYYMMDDHHMMSS.
> 
> I use EXSLT's Date library (add, duration, ...) to do this 
> conversion. It works, but the performance is very poor (e.g.: 
> 22 minutes for 3200 records).
> 
> XSLT is generated by Altova MapForce. 

Try either or both of:

(a) code it in XSLT 2.0

<xsl:variable name="epoch" select="xs:dateTime('1970-01-01T00:00:00Z')"/>
<xsl:variable name="milli" select="xs:dayTimeDuration('PT0.001S')"/>
<xsl:for-each ...
  <xsl:value-of select="format-dateTime(
     $epoch + $timestamp * $milli,
     '[Y0001][M01][D01][H01][M01][S01]')"/>

(b) run it with Saxon 8.9

My guess is if you do both then it will run in a few seconds.

Michael Kay
http://www.saxonica.com/

Current Thread