<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vish="http://marklogicgd.blogspot.com/xslt/vishnu" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:thread="java.lang.Thread"
exclude-result-prefixes="xs vish thread" version="2.0">
<xsl:variable name="millisecondsToSleep" select="7000"/>
<xsl:variable name="startTime" select="current-time()"/>
<xsl:function name="vish:threadSleep">
<xsl:param name="millisecondsToSleep" as="xs:integer"/>
<xsl:value-of select="
thread:sleep(if ($millisecondsToSleep gt 0) then
$millisecondsToSleep
else
1000)"/>
</xsl:function>
<xsl:template match="/">
Start time: <xsl:value-of select="$startTime"/>
<xsl:value-of select="vish:threadSleep($millisecondsToSleep)"/>
<xsl:variable name="endTime" select="current-time()"/>
End time: <xsl:value-of select="$endTime"/>
TimeDifference :- <xsl:value-of select="$endTime - $startTime"/>
</xsl:template>
</xsl:stylesheet>
Result:-
<?xml version="1.0" encoding="UTF-8"?>
Start time: 20:36:22.393+05:30
End time: 20:36:29.395+05:30
TimeDifference :- PT7.002
No comments:
Post a Comment