Hello,

I am trying to display the time spent in a xsl:template and i get the following behavior which i can't explain (i am using saxon_b)
Could someone explain me why do i need to display the variable $start to get the correct duration?

In the test 1: (which do not give me the result i expect)
at the beging of the template I initialize a variable $start and at the end of the template another variable $end. When displaying the result i get 0.  Why ?

In the test 2: (which give me the result i expect)
i do the same as test 1, except that i display the variable $start and in that can i get the correct result


Test 1
   <xsl:template name="Com">
     <xsl:variable name="start" select="system:currentTimeMillis()" as="xs:integer"/>
     <AUTOSAR>
         <ShortName><xsl:value-of select="lookup:defaults($currentModuleName, 'TOP-LEVEL-PACKAGE')"/></ShortName>
         <Com>
            <ShortName><xsl:value-of select="lookup:ecuModuleConfigName($currentModuleName)"/></ShortName>
            <xsl:apply-templates/>
         </Com>
      </AUTOSAR>
             <xsl:variable name="end" select="system:currentTimeMillis()" as="xs:integer"/>
             <xsl:variable name="duration" select="($end - $start)" as="xs:integer"/>
          <xsl:message>Elapsed time to generate pseudoecuconfig file of <xsl:value-of select="$currentModuleName"/> module : <xsl:value-of select="$duration"/> ms</xsl:message>
  </xsl:template>

Message Output :
Elapsed time to generate pseudoecuconfig file of Com module : 0 ms



Test 2:
   <xsl:template name="Com">
     <xsl:variable name="start" select="system:currentTimeMillis()" as="xs:integer"/>
     <xsl:message>Start : <xsl:value-of select="$start"/></xsl:message>
     <AUTOSAR>
         <ShortName><xsl:value-of select="lookup:defaults($currentModuleName, 'TOP-LEVEL-PACKAGE')"/></ShortName>
         <Com>
            <ShortName><xsl:value-of select="lookup:ecuModuleConfigName($currentModuleName)"/></ShortName>
            <xsl:apply-templates/>
         </Com>
      </AUTOSAR>
             <xsl:variable name="end" select="system:currentTimeMillis()" as="xs:integer"/>
             <xsl:variable name="duration" select="($end - $start)" as="xs:integer"/>
          <xsl:message>Elapsed time to generate pseudoecuconfig file of <xsl:value-of select="$currentModuleName"/> module : <xsl:value-of select="$duration"/> ms</xsl:message>
  </xsl:template>

Message output :
Start : 1383905589145
Elapsed time to generate pseudoecuconfig file of Com module : 68971 ms


Thank you in advance
Philippe