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

Problems calculating the running time of an xsl script

Subject: Problems calculating the running time of an xsl script
From: Alex Muir <alex.g.muir@xxxxxxxxx>
Date: Thu, 10 Dec 2009 13:03:14 +0000
 Problems calculating the running time of an xsl script
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:wi
th-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

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.