xsl-list
[Top] [All Lists]

Re: [xsl] Calling mutator java method (date fields to seconds-since-epoch with java.util.GregorianCalendar)

2006-08-22 04:45:20

But if I had the duration, how would I convert it into the number of
seconds?
something like:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xsl:param name="date"/> <!--1999-12-31T12:00:00"-->
  <xsl:template name="main">
   <xsl:value-of select="
   for $d in xs:dayTimeDuration(xs:dateTime($date) - 
xs:dateTime('1970-01-01T00:00:00'))
   return days-from-duration($d)*24*60*60 + 
   hours-from-duration($d)*60*60 +
   minutes-from-duration($d)*60 +
   seconds-from-duration($d)"/>
    
  </xsl:template>
</xsl:stylesheet>



saxon8 -it main dates.xsl  date=1999-12-31T12:00:01
<?xml version="1.0" encoding="UTF-8"?>946641601

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--