Project

Profile

Help

Support #1816 ยป testJavaDates.xsl

Radu Pisoi, 2013-06-20 13:56

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0"
xmlns:jdate="java:java.util.Date">
<xsl:template name="main">
<xsl:variable name="processstarttime" select="jdate:new()"/>
<xsl:result-document href="processingResult.xml">
<!-- cause some delay -->
<xsl:for-each select="1 to 10000000">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:result-document>
<xsl:variable name="processendtime" select="jdate:new()"/>
<xsl:variable name="elapsedtime" select="$processendtime - $processstarttime" as="xs:duration"/>
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="concat(hours-from-duration($elapsedtime), 'h ', minutes-from-duration($elapsedtime), 'm ', seconds-from-duration($elapsedtime), 's')"/>
<xsl:text> This doesn't work in Saxon 9.5.0.2 but works in Saxon 9.4.0.6</xsl:text>
</xsl:template>
</xsl:stylesheet>
    (1-1/1)