[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problems calculating the running time of an xsl s

Subject: Re: Problems calculating the running time of an xsl script
From: Alex Muir <alex.g.muir@xxxxxxxxx>
Date: Thu, 10 Dec 2009 13:50:09 +0000
Re:  Problems calculating the running time of an xsl  s
HI,

Thanks everyone for the explanation. Makes sense!

Perhaps the drop down documentation in oxygen for current-dateTime()

"This is an xs:dateTime that is current at some time during the
evaluation of a query or transformation in which fn:current-dateTime()
is executed."

should read:

This is an xs:dateTime that is current at some time during the
evaluation of a query or transformation in which fn:current-dateTime()
was first executed. Subsequent executions of fn:current-dateTime()
always return the same date and time.


Will try another approach.

Thanks Much

BTW moved the following from one line to three thinking there might be
some dynamic execution of the select in the one line version when the
variable was called and tried out if this 3 line version would be less
dynamic.. in short had no idea what was going on and grasping at
straws! :)

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

On Thu, Dec 10, 2009 at 1:21 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>>
>> 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>
>
> Why 3 lines of code where one would do?
>
> <xsl:variable name="startExecutionTime" as="xs:dateTime"
> select="current-dateTime()"/>
>
>>
>> The template appends start and current time and calculates
>> duration minutes although unlikely and seconds
>
> All calls on current-dateTime() within a single transformation are required
> to return the same result. This is because order of execution in XSLT is
> undefined - it's meaningless to talk of which expressions are evaluated "at
> the start" or "at the end" of the transformation. For example, a global
> variable might be evaluated at the start, or it might be evaluated on first
> use - or even on each use if the processor so decides.
>>
>> Is there a way to calculate the running time of an xsl script
>> within the script?
>>
>
> You can call extension functions, recognizing that the result of calling
> "impure" extension functions is not 100% predictable.
>
> But for most purposes, I'd suggest that measuring it externally (from the
> calling application) makes more sense.
>
> Regards,
>
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay
>
>



--

Alex
https://sites.google.com/a/utg.edu.gm/alex

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.