[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: difference between an integer and current-dateTime
On Mon, Mar 30, 2020 at 5:31 PM Michael Kay mike@xxxxxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: I now have following XSLT stylesheet with me, <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn0="http://fns0" exclude-result-prefixes="xs fn0" version="3.0"> <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')" as="xs:dateTime"/> <xsl:variable name="diffDTduration" select="current-dateTime() - $epochDateTime" as="xs:dayTimeDuration"/> <xsl:value-of select="fn0:secsFromdiffDTduration($diffDTduration) div 60"/> </xsl:template> <xsl:function name="fn0:secsFromdiffDTduration" as="xs:decimal"> <xsl:param name="diffDTduration" as="xs:dayTimeDuration"/> <xsl:variable name="totalSecs" select="$diffDTduration div xs:dayTimeDuration('PT1S')" /> <xsl:sequence select="$totalSecs"/> </xsl:function> </xsl:stylesheet> This gives me an output, F:\>java -classpath SaxonHE10-0J\saxon-he-10.0.jar net.sf.saxon.Transform -s:trf1.xsl -xsl:trf1.xsl secsSinceEpoch=1585633856 -53.430133333333333333333 I was expecting <xsl:value-of select="fn0:secsFromdiffDTduration($diffDTduration) div 60"/> to return me about 1 hr. But that isn't. Any thoughts? -- Regards, Mukul Gandhi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|