On 6 November 2014 17:38, Eliot Kimber ekimber(_at_)contrext(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
In my test I followed the xsl:variable instruction by an immediate
xsl:message with a reference to the variable to ensure it was evaluated
right then.
...and that this xsl:message's duration is added to $end-$start. (Yes, you
can try to cook this, too.)
-W
Cheers,
E.
----------
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com
On 11/6/14, 8:49 AM, "Michael Kay mike(_at_)saxonica(_dot_)com"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
If this is working, then it's only by chance.
Order of evaluation is undefined in XSLT, and there is no guarantee that
$start is evaluated before the apply-templates call is evaluated.
I think this only works in Saxon because the optimizer treats calls on
extension functions as suspicious, and tries to avoid over-optimizing
them because of potential side-effects.
Michael Kay
Saxonica
mike(_at_)saxonica(_dot_)com
+44 (0) 118 946 5893
On 6 Nov 2014, at 10:20, Costello, Roger L. costello(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi Folks,
So, you've got an XSLT program that is taking a long time to execute.
You want to find out what part of the program is taking so much time.
You need to insert some start/stop timers into your XSLT. Here's how to
do it:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="java:java.util.Date"
version="2.0">
<xsl:output method="text" />
<xsl:output name="text-format" method="text"/>
<xsl:template match="/">
<!-- Start a timer -->
<xsl:variable name="start" select="date:getTime(date:new())" />
<!-- Do your XSLT processing -->
<xsl:apply-templates />
<!-- End the timer -->
<xsl:variable name="end" select="date:getTime(date:new())" />
<!-- Log the benchmarking results to a file, time-info.txt -->
<xsl:result-document href="time-info.txt" format="text-format">
start: <xsl:value-of select="$start" />
end: <xsl:value-of select="$end" />
diff: <xsl:value-of select="$end - $start" />
</xsl:result-document>
</xsl:template>
<xsl:template match="*">
<!-- Do something -->
<xsl:text>Hello World </xsl:text>
<xsl:value-of select="current-dateTime()" />
</xsl:template>
</xsl:stylesheet>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--