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

Re: How to output the start execution time and the end

Subject: Re: How to output the start execution time and the end execution time?
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 6 Sep 2014 17:09:52 -0000
Re:  How to output the start execution time and the end
Dimitre,

given that the call to an external timepiece delivers the wallclock time:
how can one be sure that a call near the top of the  XSLT program is
executed first, e.g., before accessing the main document? And how can one
be sure that a call near the end of the program is the last thing the
program does, e.g., even after writing/serializing everything and flushing
all buffers?

Not really knowing what one measures? Not being sure how the data
influences the result?

-W



On 6 September 2014 18:31, Abel Braaksma (Exselt) abel@xxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Roger,
>
> Functions and constructs in XSLT and XPath are stable (barring a few
> exceptions). Calling a function with the same argument twice will yield the
> same result for both calls. The functions current-time(),
> current-dateTime() and current-date() will therefor always return the same
> time (with a slight caveat for static and dynamic evaluation phases, but
> let's not digress).
>
> The only way out here is extension functions, or a trick with XSLT 3.0
> using streaming, because the xsl:stream instruction is deemed non-stable
> (i.e., it will re-invoke the url at the href argument each time it is
> called). Whether an extension function helps depends whether your processor
> allows non-stable extension functions, but I believe most, if not all,
> processors do.
>
> Here's a (workable) trick that works with all XSLT 3.0 processors, however
> you might want to choose a local resource instead that returns the current
> date-time, for performance reasons.
>
>
> <xsl:mode streamable="yes" name="time" on-no-match="shallow-skip" >
>
> <!-- may need an actual argument to force re-evaluation -->
> <xsl:function name="my:current-time">
>   <xsl:stream href="http://time.is">
>     <xsl:apply-templates mode="time" />
>   </xsl:stream>
> </xsl:function>
>
> <!-- match the element that contains the time -->
> <xsl:template match="div[@id = 'twd']">
>     <xsl:value-of select="." />
> </xsl:template>
>
> <xsl:template match="/">
>      <xsl:value-of select="my:current-time()" />
>      ... do the processing ...
>      <xsl:value-of select="my:current-time()" />
>  </xsl:template>
>
>
> Note: the page http://time.is currently does not deliver proper XML (and
> on my search for a time server that did deliver proper XML or even proper
> XHTML I did not find any). If you can convince your processor not to cache
> the result of unparsed-text, you can use the following with the same server
> as a workaround (ugly, but it shows the principle):
>
> <xsl:value-of select="replace(unparsed-text('http://time.is/'),
> '.+twd&quot;&gt;([^&lt;]+).*', '$1', 'sm')" />
>
> Cheers,
> Abel
>
>
> > -----Original Message-----
> > From: Costello, Roger L. costello@xxxxxxxxx [mailto:xsl-list-
> > service@xxxxxxxxxxxxxxxxxxxxxx]
> > Sent: Saturday, September 06, 2014 11:47 AM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  How to output the start execution time and the end
> execution
> > time?
> >
> > 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()" />
> >     </xsl:template>
> >
> > What is the correct way to accomplish this?
> >
> > /Roger

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.