Re: [xsl] difference between an integer and current-dateTime()

Subject: Re: [xsl] difference between an integer and current-dateTime()
From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Apr 2020 05:03:48 -0000
Hi Martin,

On Tue, Mar 31, 2020 at 1:34 PM Martin Honnen martin.honnen@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

In general, if you want the difference in seconds, I would suggest to use
   div xs:dayTimeDuration('PT1S')
for minutes
   div xs:dayTimeDuration('PT1M')
or for hours
   div xs:dayTimeDuration('PT1H')

I tried following with Saxon,
trf1.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                         xmlns:xs="http://www.w3.org/2001/XMLSchema";
                         exclude-result-prefixes="xs"
                         version="3.0">

    <xsl:output method="text"/>

    <xsl:template match="/">
         <xsl:variable name="dt1" select="xs:dayTimeDuration('PT5H')"/>
         <xsl:value-of select="$dt1 div xs:dayTimeDuration('PT2.5H')"/>

    </xsl:template>

</xsl:stylesheet>

And I get following on running above stylesheet,

F:\>java -classpath f:\SaxonHE10-0J\saxon-he-10.0.jar
net.sf.saxon.Transform -s:trf1.xsl -xsl:trf1.xsl
Warning at char 28 in xsl:value-of/@select on line 10 column 69 of trf1.xsl:
  SXWN9000  Evaluation will always throw a dynamic error: Invalid duration
value 'PT2.5H' (H
  is out of sequence)
Error at char 28 in expression in xsl:value-of/@select on line 10 column 69
of trf1.xsl:
  FORG0001  Invalid duration value 'PT2.5H' (H is out of sequence)
  In template rule with match="/" on line 8 of trf1.xsl
Invalid duration value 'PT2.5H' (H is out of sequence)

What I'm not doing correctly?



-- 
Regards,
Mukul Gandhi

Current Thread