XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

fn:seconds-from-time

Category:

Value extraction from time values, date values and duration

Origin:

XPath 2.0

Return value:

A xs:decimal decimal value which corresponds to the portion of the seconds and split seconds of a daytime value passed on.

Call/Arguments:

fn:seconds-from-time($timeValue)

$timeValue:

Optional. A daytime indication of xs:time type which may contain a timezone indication. If the empty sequence is passed on, the function returns an empty result sequence.

Purpose of use:

The function returns a decimal number between 0 and 60.99 (attention: not 59.99, see below!) which corresponds to the value of the seconds component and its fractions of the time value passed on. The value passed on must be formally normalised, which means an implicitly or explicitly existing timezone indication must be included. However, this has no influence on the value of the seconds component.

Theoretically, the value may exceed the number of 60 seconds because, occassionally, leap seconds are inserted in order to adjust the official timing to the irregularities of the rotation of the earth. However, this only happens on 30 June or on 31 December at 23:59:59 UTC. Accordingly, a value greater than 60 is extremely rare. (For a more detailed explanation, see the fn:seconds-from-dateTime() function.)

Example – extraction of the seconds from a daytime value:

fn:seconds-from-time(xs:time("15:30:12.67"))

results in the value: 12.67.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:seconds-from-time($arg as xs:time?) as xs:decimal?

   

<< back next >>

 

 

 


Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.


Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany