Hi,
On each XSL files I'm setting a global variable to store the current date time.
<xsl:variable name="startExecutionTime" as="xs:dateTime">
<xsl:value-of select="current-dateTime()"/>
</xsl:variable>
And then have a template that in theory might execute last as it
appends content to the end of the xml file which calls a template in
an included file
<xsl:template match="endProcessing">
<xsl:call-template name="Processing">
<xsl:with-param name="name"
select="functx:substring-after-last-match(fn:static-base-uri(),'/')"></xsl:with-param>
<xsl:with-param name="startExecutionTime" select="$startExecutionTime"/>
</xsl:call-template>
</xsl:template>
The template appends start and current time and calculates duration
minutes although unlikely and seconds
<xsl:template name="Processing">
<xsl:param name="startExecutionTime"></xsl:param>
<xsl:param name="name"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
<xsl:element name="widget">
<xsl:attribute name="name" select="$name"/>
<xsl:attribute name="startExecutionTime" select="$startExecutionTime"/>
<xsl:attribute name="CurrentExecutionTime" select="current-dateTime()"/>
<xsl:attribute name="minutes"
select="minutes-from-duration(current-dateTime() -
$startExecutionTime)"/>
<xsl:attribute name="seconds"
select="seconds-from-duration(current-dateTime() -
$startExecutionTime)"/>
</xsl:element>
</xsl:copy>
</xsl:template>
Problem is that the startExecutionTime and the CurrentExecutionTime
are always the same resulting in zero duration
<widget name="one.xsl" startExecutionTime="2009-12-10T12:08:34.406Z"
CurrentExecutionTime="2009-12-10T12:08:34.406Z"
minutes="0" seconds="0"/>
<widget name="two.xsl" startExecutionTime="2009-12-10T12:08:36.64Z"
CurrentExecutionTime="2009-12-10T12:08:36.64Z" minutes="0"
seconds="0"/>
<widget name="three.xsl" startExecutionTime="2009-12-10T12:08:39.484Z"
CurrentExecutionTime="2009-12-10T12:08:39.484Z"
minutes="0" seconds="0"/>
Time passes between widgets suggesting they don't process without
milliseconds going by although that would be sweet!
One thing I was wondering is when you have the current-dateTime()
within a global variable will that represent the time you use the
variable and not when the processing starts?
I'm thinking to pass the time in as a parameter from xproc on my next
attempt at this.
Is there a way to calculate the running time of an xsl script within the script?
Kind Regards
--
Alex
https://sites.google.com/a/utg.edu.gm/alex
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--