⬆️ ⬇️

Timestamp from date-time using XSLT

In life, it so happens that in spite of all the love for data differentiation and presentation, the day comes when it is necessary to transfer part of the logic to the XSLT template.



In my case, there was nothing criminal on the horizon: it was necessary to calculate the time between two events in a hierarchical XML log. Date and time were stored in a format partially compatible with RFC 3339 .



This compatibility was provided by the correct date notation of yyyy-MM-dd and time hh:mm:ss.SS , but the following deviations from the standard took place:

  1. The date and time are separated by a space, not by the letter T ;
  2. The number of digits denoting milliseconds could vary from “none” to “many, many”;
  3. The time zone was not specified at all.
At first I wanted to use a ready-made solution with exslt.org - date:difference , but I had to give it up. The fact is that the difference was required to receive with an accuracy of milliseconds, and this algorithm returned a valid xsd:duration (ISO 8601), which does not contain milliseconds. In addition, parsing someone else's output, although formalized - is not very grateful. Thus, having rummaged a bit in exslt, I decided to write the parser myself, in the hope that I can do it quickly ...



It was decided to build the templates in an extension with the same namespace as that of exslt, so the container < xsl:stylesheet/ > appropriate:

  1. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  2. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  3. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  4. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  5. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  6. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
  7. <? xml version ="1.0" encoding ="utf-8" ? > < xsl:stylesheet version ="1.0" xmlns:date ="date" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes ="date"> <!-- Source code goes here --> </ xsl:stylesheet >
The extension namespace declared using extension-element-prefixes will be used by templates, and the XML namespace date:* will be used only once for the declaration of the following container:

  1. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  2. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  3. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  4. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  5. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  6. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  7. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  8. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  9. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  10. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  11. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  12. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  13. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
  14. < date:month > < january > 31 </ january > < february > 28 </ february > < march > 31 </ march > < april > 30 </ april > < may > 31 </ may > < june > 30 </ june > < july > 31 </ july > < august > 31 </ august > < september > 30 </ september > < october > 31 </ october > < november > 30 </ november > < december > 31 </ december > </ date:month >
To make it easier to get the number of days by the number or name of the month, we enter a variable:

')

< xsl:variable name ="date:month"

select ="document('')//date:month"/>



Now you can write XPath like sum($date:month/*[$i>=position()])+($i>2) - the total number of leap year days for the $i th month inclusive.



In the process of parsing the date-time string, it was often necessary to check the numerical values ​​for coincidence with NaN and, in the case of a positive comparison, replace them with 0 . This would generate a set of < xsl:if /> which heavily cluttered the code. Therefore, I began to use a translate like this:



translate($expression,'NaN',0)



But such code is also not neat. After not long deliberation, the option was chosen with the auto-format of fractional numbers:



< xsl:decimal-format NaN ="0"/>



Interestingly, in Opera 10.53, the format-number function does not know how to work with three arguments and produces unknown error, which makes it impossible to use named decimal-format number formats like this:

  1. < xsl:decimal-format name ="date:NaN" NaN ="0">
  2. < xsl:decimal-format name ="date:NaN" NaN ="0">
Those. This XPath will drop the template: format-number($expression,0,'date:NaN')



Date-time to timestamp


The following listing is a template for converting date-time to millisecond timetamp:

  1. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  2. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  3. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  4. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  5. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  6. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  7. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  8. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  9. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  10. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  11. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  12. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  13. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  14. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  15. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  16. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  17. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  18. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  19. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  20. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  21. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  22. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  23. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  24. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  25. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  26. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  27. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  28. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  29. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  30. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  31. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  32. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  33. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  34. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  35. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  36. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  37. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  38. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  39. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  40. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  41. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  42. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  43. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  44. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  45. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  46. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  47. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  48. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  49. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  50. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  51. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  52. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  53. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  54. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  55. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  56. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  57. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
  58. < xsl:template name ="date:timestamp" > < xsl:param name ="date-time" /> < xsl:variable name ="compact" select =" normalize-space( translate($date-time,'TZ ',''))" /> < xsl:variable name ="year" select =" translate( substring($compact,1, 4+(starts-with($compact,'+') or starts-with($compact,'-'))), '+','')"/> < xsl:variable name ="date" select ="substring-after($compact,$year)" /> < xsl:variable name ="time" select ="substring($date,7)" /> < xsl:variable name ="month" select ="format-number(substring($date,2,2)-1,0)" /> < xsl:variable name ="utc-offset" > < xsl:variable name ="raw" select =" concat( substring-after($time,'+'), substring-after($time,'-'))"/> < xsl:variable select =" format-number( (contains($time,'-')-.5) *2*(substring($raw,1,2)*60 +substring($raw,4,2)),0)"/> </ xsl:variable > < xsl:variable select =" format-number( 1000*( 24*3600*( $year*365-719527 +floor($year div 4) -floor($year div 100) +floor($year div 400) +sum($date:month/*[$month>=position()]) +format-number(substring($date,5,2)-1,0) -(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0))) +format-number( concat(0,substring($time,7, (substring($time,6,1)=':')*2)) +substring($time,1,2)*3600 +substring($time,4,2)*60,0) +$utc-offset*60) +format-number( round( (substring($time,9,1)='.') *1000*substring-before( translate( concat('0.',substring-after($time,'.'),'_'), '+-','__'),'_')),0),0)"/> </ xsl:template >
I will not go into the details of the calculations, just tell you about its capabilities.



@param Takes a single $date-time parameter to which the formatted string is passed. The presence and number of spaces inside the string does not matter - they are all translated. Date spacers can be any single character except space.



The generic pattern for a parameter is as follows:



RFC 3339 date-time pattern



yyyy - year

MM - month

dd - day

T - date identifier

hh - watch

mm - minutes

S - fractional part of a second, may contain an arbitrary number of digits (including none)

Z - UTC identifier timezone

[] - the contents of the brackets can be present or not;

() - the contents of the brackets must be present;

| - or



@output Returns the number of milliseconds elapsed since the beginning of the Unix-era 1970-01-01T00: 00: 00Z.



Timestamp to date-time


This listing is a reverse conversion, from a number to an RFC-formatted string.

  1. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  2. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  3. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  4. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  5. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  6. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  7. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  8. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  9. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  10. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  11. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  12. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  13. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  14. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  15. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  16. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  17. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  18. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  19. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  20. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  21. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  22. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  23. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  24. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  25. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  26. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  27. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  28. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  29. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  30. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  31. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  32. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  33. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  34. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  35. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  36. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  37. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  38. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  39. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  40. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  41. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  42. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  43. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  44. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  45. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  46. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  47. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  48. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  49. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  50. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  51. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
  52. < xsl:template name ="date:date-time" > < xsl:param name ="timestamp" /> < xsl:if test ="not(format-number($timestamp,0)='NaN')" > < xsl:variable name ="days" select ="$timestamp div (24*3600000)" /> < xsl:variable name ="time" select =" $timestamp div 1000 -floor($days)*24*3600" /> < xsl:variable name ="year" select =" 1970+floor( format-number($days div 365.24,'0.#'))" /> < xsl:variable name ="year-offset" select =" 719528-$year*365 -floor($year div 4) +floor($year div 100) -floor($year div 400) +floor($days)"/> < xsl:variable name ="month" select =" count($date:month /*[$year-offset>=sum(preceding-sibling::*)][last()] /preceding-sibling::*)" /> < xsl:variable name ="hours" select ="floor($time div 3600)" /> < xsl:variable name ="min" select ="floor($time div 60-$hours*60)" /> < xsl:variable name ="sec" select ="floor($time -$hours*3600-$min*60)" /> < xsl:variable select =" concat( format-number($year,'0000'),'-', format-number($month+1,'00'),'-', format-number( $year-offset -sum($date:month/*[$month>=position()]) +(2>$month and (($year mod 4=0 and $year mod 100!=0) or $year mod 400=0)), '00'),'T', format-number($hours,'00'),':', format-number($min,'00'),':', format-number($sec,'00'),'.', format-number( 1000*($time -$hours*3600 -$min*60-$sec), '000'),'Z')" /> </ xsl:if > </ xsl:template >
@param Like the previous template, accepts a single parameter. $timestamp - the number of milliseconds elapsed from 1970-01-01T00: 00: 00Z. If the date is earlier than 1970, then the timestamp should be negative.



@output A string of the form [ - | + ] yyyy - MM - dd T hh : mm : ss . SSS Z [ - | + ] yyyy - MM - dd T hh : mm : ss . SSS Z



I checked patterns, both with negative years and with positive ones - the result is similar to the truth. Tests and source can be picked up on rapidshare . If you don't like Rapida, I'll post it somewhere else.

Source: https://habr.com/ru/post/95771/



All Articles