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

Subject: Re: [xsl] Doing Math on Durations and Creating dayTimeDuration Instances
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Oct 2016 16:06:30 -0000
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@xxxxxxxxx> 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@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxx"
>>> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>
>>>> On Thu, Oct 6, 2016, at 11:40, Eliot Kimber ekimber@xxxxxxxxxxxx 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@xxxxxxxx      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.

Current Thread