[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Problems calculating the running time of an xsl script


Subject: Re: [xsl] Problems calculating the running time of an xsl script
From: Michael Ludwig <milu71@xxxxxx>
Date: Thu, 10 Dec 2009 14:14:48 +0100

Alex Muir schrieb am 10.12.2009 um 13:03:14 (+0000):

> 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>

Could be written more concisely as:

  <xsl:variable name="startExecutionTime"
    select="current-dateTime()" as="xs:dateTime" />

> 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

XSLT deals with trees, not with files. So there is no "appending".
Conceptually, XSLT processing does not happen sequentially, but all in
once. The order of execution is up to the XSLT processor, which may
choose to optimize one way or the other.

> Problem is that the startExecutionTime and the CurrentExecutionTime
> are always the same resulting in zero duration

The expression is evaluated only once. What you get is the time at
invocation.

> I'm thinking to pass the time in as a parameter from xproc on my next
> attempt at this.

The time passed in would be moreless the same as from within the XSLT
processor, wouldn't it?

> Is there a way to calculate the running time of an xsl script within
> the script?

Take a timestamp before execution, and another after execution.

-- 
Michael Ludwig


Current Thread
Keywords