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

Re: [xsl] How to output the start execution time and the end execution time?

Subject: Re: [xsl] How to output the start execution time and the end execution time?
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 6 Sep 2014 15:56:37 -0000

At 2014-09-06 09:46 +0000, Costello, Roger L. costello@xxxxxxxxx wrote:
Hi Folks,

I would like to:

1. Output the time that my XSLT program starts processing
2. Do the processing
3. Output the time that my XSLT program finishes processing

This doesn't work:

    <xsl:template match="/">
        <xsl:value-of select="current-time()" />
        ... do the processing ...
        <xsl:value-of select="current-time()" />

The current time is a static value for the duration of execution of the stylesheet.

What is the correct way to accomplish this?

Outside of XSLT. Record the time, invoke and execute the stylesheet, record the time.

I suggestion you also take the time (so to speak) to run your input data through the following stylesheet:

<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:template match="/">
  <xsl:copy-of select="."/>


... and take that duration away from your execution duration so that you have accommodated the time to build the input tree and serialize an output tree (even if the output tree won't be identical at least you'll get some time accommodated). That time is separate from your logic processing time.

If you have the chance to run your "... do the processing ..." multiple times, say 100 times, and then divide the execution time by 100 that might give you some accuracy (then, again, perhaps not if the optimization precludes some execution for 99 times).

I hope this helps.

. . . . . . . Ken

Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/ |
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile:      http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |

--- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Current Thread