Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Calculating duration

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 4/3/2007 8:23:00 AM

"Erazem Polutnik" <erazem_polutnik@h...> wrote in message 
news:euh38u05d1@e......
> Hi, many thanks for your input. Indeed my intention was to ask how to do 
> it in XSLT 1.0.
> I realize I will need two functions to do this, but I have no clue how to 
> write them in XSL file.
> Why is document in my previous post malformed. Is this one better
> <contest>
>  <contest_days>
>    <contest_day id="1">
>       <entries>
>          <entry>
>            <contestant>Mike</contestant>
>            <start>12:17:15</start>
>            <finish>16:31:17</finish>
>          </entry>
>          <entry>
>            <contestant>Luke</contestant>
>            <start>12:17:15</start>
>            <finish>16:31:17</finish>
>          </entry>
>          <entry>
>            <contestant>Sven</contestant>
>            <start>12:17:15</start>
>            <finish>16:31:17</finish>
>          </entry>
>       </entries>
>    </contest_day>
>  </contest_days>
> </contest>
>
> Thanks once more.
> Erazem
>
You maybe able to find some pre-written code online but to convert the times 
to seconds is straightforward enough.
Use substring and substring-before to separate the hour, minutes and seconds 
and then add the seconds to 60 times the minutes and to 60 times 60 times 
the hours.
The reverse process will need to use the div and the mod operators.

See the msxml online SDK for examples.

Alternatively upgrade to an XSLT processor that uses version 2.0, this has 
these sort of functions built in.

One final point, are all  your time periods contained within one day? For 
instance you don't get people starting at 23:00:00 and finishing at 
01:00:00?
This would make it more tricky.

-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent