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: Sat, 28 Mar 2020 00:23:31 -0000
Hi Martin,
   Thanks for reply.

> On Fri, Mar 27, 2020 at 5:35 PM Martin Honnen martin.honnen@xxxxxx

I've tried following XSLT stylesheet upto now, based on your suggestions,

<xsl:stylesheet xmlns:xsl="";

    <xsl:output method="text"/>

    <xsl:param name="secsSinceEpoch" as="xs:integer"/>

    <xsl:template match="/">
       <xsl:variable name="epochDateTime"
select="xs:dateTime('1970-01-01T00:00:00Z') +

     xs:dayTimeDuration('PT' || $secsSinceEpoch || 'S')"

       <xsl:variable name="diffDTduration" select="current-dateTime() -
$epochDateTime" as="xs:dayTimeDuration"/>
       <xs:value-of select="$diffDTduration"/>


When I invoke above stylesheet, as follows (using Saxon 10),

java -classpath saxon-he-10.0.jar net.sf.saxon.Transform -s:trf1.xsl
-xsl:trf1.xsl secsSinceEpoch=1585039138

I get nothing into the output (i.e, <xs:value-of select="$diffDTduration"/>
doesn't print anything). Any thoughts, how can I proceed further?

But there looks to be a valid value within the variable,  'epochDateTime'.

Mukul Gandhi

Current Thread