xsl-list
[Top] [All Lists]

Re: [xsl] Doing Math on Durations and Creating dayTimeDuration Instances

2016-10-06 11:06:36
It would be better to have titles as:

10.8.1  "2008-12-11"  -  "2007-03-15"  = xxxxx hours --- get the
duration of a period by subtracting its start from its end


But for this to be adopted, we might need a culture revolution ...   :)


Cheers,
Dimitre

On Thu, Oct 6, 2016 at 9:00 AM, Dimitre Novatchev 
<dnovatchev(_at_)gmail(_dot_)com> wrote:
A lot of people miss this one. By providing a convenient operator for this 
common operation,
we ensured that people searching the function library wouldn't find it...

Michael Kay
Saxonica

The reason is the "op:some-descriptiveName"  convention created
totally unreadable document that requires a lot of effort to
understand what each name actually means:

     10.8 Arithmetic Operators on Durations, Dates and Times
        10.8.1 op:subtract-dateTimes
        10.8.2 op:subtract-dates
        10.8.3 op:subtract-times
        10.8.4 op:add-yearMonthDuration-to-dateTime
        10.8.5 op:add-dayTimeDuration-to-dateTime
        10.8.6 op:subtract-yearMonthDuration-from-dateTime
        10.8.7 op:subtract-dayTimeDuration-from-dateTime
        10.8.8 op:add-yearMonthDuration-to-date
        10.8.9 op:add-dayTimeDuration-to-date
        10.8.10 op:subtract-yearMonthDuration-from-date
        10.8.11 op:subtract-dayTimeDuration-from-date
        10.8.12 op:add-dayTimeDuration-to-time
        10.8.13 op:subtract-dayTimeDuration-from-time

In the above (TOC of the W3C XPath 2.0 F & O standard), the
subtraction  " - " of twodateTime values is difficult to find and
understand even though it is the first in the list and must be the
easiest to see.

I think that the above is a very effective encryption of the contents
of the document.

On Thu, Oct 6, 2016 at 7:02 AM, Michael Kay mike(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
A lot of people miss this one. By providing a convenient operator for this 
common operation, we ensured that people searching the function library 
wouldn't find it...

Michael Kay
Saxonica

On 6 Oct 2016, at 13:37, Eliot Kimber ekimber(_at_)contrext(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I think that's what I missed: I didn't realize you could do arithmetic
that directly.

I'll try it.

Cheers,

Eliot
--
Eliot Kimber
http://contrext.com







On 10/6/16, 12:24 PM, "Jirka Kosek jirka(_at_)kosek(_dot_)cz"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

On Thu, Oct 6, 2016, at 11:40, Eliot Kimber 
ekimber(_at_)contrext(_dot_)com wrote:
I'm using XSLT to extract timing information from logs in order to
determine the duration of actions. Each log item has a time stamp in the
usual format (2016-10-05T15:52:17.525:+0200).

And why are you simply not just subtracting two dateTimes, something
like:

xs:dateTime("2015-01-01T12:00:00Z") -
xs:dateTime("2014-07-10T12:00:00Z")

This will give you back duration. Or perhaps I have misunderstood...

Jirka

--
------------------------------------------------------------------
Jirka Kosek      e-mail: jirka(_at_)kosek(_dot_)cz      http://xmlguru.cz
------------------------------------------------------------------
     Professional XML consulting and training services
DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------







--
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.



-- 
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.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>