<?xml version="1.0"?>
<exslt:function xmlns:exslt="http://exslt.org/documentation" 
               version="1" module="date" status="implemented">

<exslt:name>duration</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="date:seconds">
   <dc:subject>EXSLT</dc:subject>
   <dc:subject>date</dc:subject>
   <dc:subject>duration</dc:subject>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.1">
         <exslt:version>1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-05-12</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Returns the result of converting the argument number of seconds to a duration string, or the current date/time as a duration since 1970-01-01T00:00:00Z.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.1.1">
         <exslt:version>1.1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-06-11</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Added Javascript implementation.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.1.2">
         <exslt:version>1.2</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-06-12</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Added implementations in XSLT and EXSLT - Functions.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.1.3">
         <exslt:version>1.3</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-06-16</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            <ul>
               <li>Updated Javascript implementation.</li>
               <li>Added Microsoft-specific stylesheet.</li>
            </ul>
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.1.4">
         <exslt:version>1.4</exslt:version>
         <dc:creator email="craig.stewart@nottingham.ac.uk" 
                     url="">Craig Stewart</dc:creator>
         <dc:date>2002-08-21</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">Added libxslt implementation to the list.</dc:description>
      </rdf:Description>
   </exslt:revision>
</rdf:Description>

<exslt:doc xmlns:html="http://www.w3.org/1999/xhtml"
           xmlns="">
   <html:div xmlns="http://www.w3.org/1999/xhtml">
      <p>
         The <code>date:duration</code> function returns a duration string representing the number of seconds specified by the argument string.  If no argument is given, then the result of calling <a href="/date/functions/seconds"><code>date:seconds</code></a> without any arguments is used as a default argument.
      </p>
      <p>
         The duration is returned as a string in the format defined for <code>xs:duration</code> in [<a href="http://www.w3.org/TR/xmlschema-2/#duration" class="offsite">3.2.6 duration</a>] of [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>].
      </p>
      <p>
         The number of years and months in the duration string must be equal to zero.  (The format of the string will be <code>P<var>n</var>DT<var>n</var>H<var>n</var>M<var>n</var>S</code>.)  The number of seconds specified in the duration string must be less than 60; the number of minutes must be less than 60; the number of hours must be less than 24.
      </p>
      <p>
         If the argument is <code>Infinity</code>, <code>-Infinity</code> or <code>NaN</code>, then <code>date:duration</code> returns an empty string (<code>''</code>).
      </p>
   </html:div>
</exslt:doc>

<exslt:definition xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <exslt:return type="string" />
   <exslt:arg name="seconds" type="number" 
              optional="yes" default="date:seconds()" />
</exslt:definition>

<exslt:implementations>
   <exslt:vendor-implementation
           version="1"
           vendor="libxslt from Daniel Veillard et al."
           vendor-url="http://xmlsoft.org/XSLT/"
           vendor-version="1.0.19" />
   <exslt:implementation src="date.duration.function.xsl" language="exslt:exslt" 
                         version="1">
      <exslt:doc xmlns:html="http://www.w3.org/1999/xhtml">
         <html:div xmlns="http://www.w3.org/1999/xhtml">
            <p>
               This implementation relies on <a href="../date-time/date.seconds.html"><code>date:seconds()</code></a> being available in order to get the current date/time.  If it isn't, it gives a zero duration (for now).
            </p>
         </html:div>
      </exslt:doc>
   </exslt:implementation>
   <exslt:implementation src="date.duration.template.xsl" language="exslt:xslt" 
                         version="1">
      <exslt:doc xmlns:html="http://www.w3.org/1999/xhtml">
         <html:div xmlns="http://www.w3.org/1999/xhtml">
            <p>
               This implementation relies on <a href="../date-time/date.seconds.html"><code>date:seconds()</code></a> being available in order to get the current date/time.  If it isn't, it gives a zero duration (for now).
            </p>
         </html:div>
      </exslt:doc>
   </exslt:implementation>
   <exslt:implementation src="date.js" language="exslt:javascript" 
                         version="1">
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.js">
         <dc:subject>EXSLT</dc:subject>
         <dc:subject>date</dc:subject>
         <dc:subject>duration</dc:subject>
         <dc:subject>Javascript</dc:subject>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:duration.js.1">
               <exslt:version>1</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-11</dc:date>
            </rdf:Description>
         </exslt:revision>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:duration.js.2">
               <exslt:version>2</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-16</dc:date>
            </rdf:Description>
         </exslt:revision>
      </rdf:Description>
   </exslt:implementation>
   <exslt:implementation src="date.msxsl.xsl" language="exslt:msxsl"
                         version="1">
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:duration.msxsl">
         <dc:subject>EXSLT</dc:subject>
         <dc:subject>date</dc:subject>
         <dc:subject>duration</dc:subject>
         <dc:subject>MSXML</dc:subject>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:duration.msxsl.1">
               <exslt:version>1</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-16</dc:date>
            </rdf:Description>
         </exslt:revision>
      </rdf:Description>
   </exslt:implementation>
</exslt:implementations>

<exslt:use-cases />

</exslt:function>