Subject: Re: [xsl] difference between an integer and current-dateTime() From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 30 Mar 2020 16:55:32 -0000 |
I posted that at the beginning of the thread within minutes of Martin's response:
https://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/202003 /msg00084.html
23/36305So you really missed this simple solution:B <https://stackoverflow.com/a/3468123/36305>https://stackoverflow.com/a/34681
errytech.com>
( current-dateTime() - xs:dateTime('1970-01-01T00:00:00') ) div xs:dayTimeDuration('PT1S')
On Mon, Mar 30, 2020 at 4:51 AM Mukul Gandhi <mailto:gandhi.mukul@xxxxxxxxx>gandhi.mukul@xxxxxxxxx <<mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>xsl-list-service@xxxxxxxxxx
wrote: On Mon, Mar 30, 2020 at 12:23 PM Martin Honnen <mailto:martin.honnen@xxxxxx>martin.honnen@xxxxxx
<<mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>xsl-list-service@xxxxxxxxxxx rrytech.com>
Transform"wrote: Am 30.03.2020 um 08:49 schrieb Mukul Gandhi <mailto:gandhi.mukul@xxxxxxxxx>gandhi.mukul@xxxxxxxxx:
B Here you have used the wrong prefix "xs" again, instead you want B B B <xsl:sequence select="$totalSecs"/> no?
The following finally works for me,
<xsl:stylesheet xmlns:xsl="<http://www.w3.org/1999/XSL/Transform>http://www.w3.org/1999/XSL/
"B B B B B B B B B B B B B xmlns:xs="<http://www.w3.org/2001/XMLSchema>http://www.w3.org/2001/XMLSchema
'S')"B B B B B B B B B B B B B xmlns:fn0="<http://fns0>http://fns0" B B B B B B B B B B B B B exclude-result-prefixes="xs fn0" B B B B B B B B B B B B B version="3.0"> B B B B B B B B B B <xsl:output method="text"/> B B B B B B B B B B B B B B B B B B <xsl:param name="secsSinceEpoch" as="xs:integer"/> B B B B B B B B B B B B <xsl:template match="/"> B B B B <xsl:variable name="epochDateTime" select="xs:dateTime('1970-01-01T00:00:00Z') + B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B xs:dayTimeDuration('PT' || $secsSinceEpoch ||
B B B B B B B B B B B B B B B B B B B B B as="xs:dateTime"/> B B B B <xsl:variable name="diffDTduration" select="current-dateTime() - $epochDateTime" as="xs:dayTimeDuration"/> B B B B <xsl:value-of select="fn0:minsFromdiffDTduration($diffDTduration)"/> B B </xsl:template> B B B B <xsl:function name="fn0:minsFromdiffDTduration" as="xs:decimal"> B B B B <xsl:param name="diffDTduration" as="xs:dayTimeDuration"/> B B B B B B B B <xsl:variable name="yrsDuration" select="years-from-duration($diffDTduration)"/> B B B B <xsl:variable name="mnthsDuration" select="months-from-duration($diffDTduration)"/> B B B B <xsl:variable name="daysDuration" select="days-from-duration($diffDTduration)"/> B B B B <xsl:variable name="hrsDuration" select="hours-from-duration($diffDTduration)"/> B B B B <xsl:variable name="mnsDuration" select="minutes-from-duration($diffDTduration)"/> B B B B <xsl:variable name="secsDuration" select="seconds-from-duration($diffDTduration)"/> B B B B B B B B <xsl:variable name="totalSecs" select="$yrsDuration * 365 * 24 * 60 + $mnthsDuration * 30 * 24 * 60 + B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B $daysDuration * 24 * 60 + $hrsDuration * 60 + $mnsDuration + B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B $secsDuration div 60" /> B B B B <xsl:sequence select="$totalSecs"/> B B B B </xsl:function> B B </xsl:stylesheet>
Many thanks.
-- Regards, Mukul Gandhi <http://www.mulberrytech.com/xsl/xsl-list>XSL-List info and archive <http://lists.mulberrytech.com/unsub/xsl-list/782854>EasyUnsubscribe (by email)
-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- To avoid situations in which you might make mistakes may be the biggest mistake of all ------------------------------------ Quality means doing it right when no one is looking. ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- To achieve the impossible dream, try going to sleep. ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :) ------------------------------------- Sanity is madness put to good use. ------------------------------------- I finally figured out the only reason to be alive is to enjoy it. B <http://www.mulberrytech.com/xsl/xsl-list>XSL-List info and archive <http://lists.mulberrytech.com/unsub/xsl-list/96802>EasyUnsubscribe (<>by email)
-- Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) | Essays (UBL, XML, etc.) http://www.linkedin.com/today/author/gkholman |
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] difference between an int, Dimitre Novatchev dn | Thread | Re: [xsl] difference between an int, G. Ken Holman g.ken. |
Re: [xsl] [ANN] Saxon 10.0 (today's, Debbie Lockett debbi | Date | Re: [xsl] difference between an int, Mukul Gandhi gandhi. |
Month |