Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Calculating duration [Thread Next] Re: Calculating durationTo: 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
