home contribute faq download

FunctX XSLT Functions

functx:total-seconds-from-duration

The total number of seconds in a dayTimeDuration

Google
Webxsltfunctions.com

Description

The functx:total-seconds-from-duration function returns the total number of seconds in $duration. This is different from the built-in fn:seconds-from-duration function because the latter will normalize the value and only give you the remainder number of seconds between 1 and 60. For example, fn:seconds-from-duration(xs:dayTimeDuration("PT90S")) will return 30, while functx:total-seconds-from-duration(xs:dayTimeDuration("PT90S")) will return 90. If $duration is the empty sequence, the empty sequence is returned.

Arguments and Return Type

NameTypeDescription
$duration xs:dayTimeDuration? the duration
return value xs:decimal?

XSLT Function Declaration

See XQuery definition.
XSLT 2.0 Syntax:
<xsl:function name="functx:total-seconds-from-duration" as="xs:decimal?" 
              xmlns:functx="http://www.functx.com" >
  <xsl:param name="duration" as="xs:dayTimeDuration?"/> 
 
  <xsl:sequence select=" 
   $duration div xs:dayTimeDuration('PT1S')
 "/>
   
</xsl:function>

Examples

XSLT ExampleResults
functx:total-seconds-from-duration(
     xs:dayTimeDuration('PT90S'))
90
functx:total-seconds-from-duration(
     xs:dayTimeDuration('PT90.5S'))
90.5
functx:total-seconds-from-duration(
     xs:dayTimeDuration('PT1M30S'))
90
functx:total-seconds-from-duration(
     xs:dayTimeDuration('PT3M'))
180

See Also

fn:seconds-from-durationThe number of seconds in a duration
functx:total-minutes-from-durationThe total number of minutes in a dayTimeDuration
functx:total-hours-from-durationThe total number of hours in a dayTimeDuration
functx:total-days-from-durationThe total number of days in a dayTimeDuration
functx:total-months-from-durationThe total number of months in a yearMonthDuration
functx:total-years-from-durationThe total number of years in a yearMonthDuration

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley