XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Value extraction from time values, date values and duration
An integer of xs:integer type; the value of the minutes component of the duration value passed on after canonisation.
Optional. A xs:duration duration indication from which, after conversion into the xs:dayTimeDuration type in its canonical form PnDTnHnMnS, the value of the minutes component resulting from this is extracted. If the empty sequence is passed on, the function returns an empty result sequence.
Purpose of use:
The function returns an integer which results from the minutes component of a duration value after transferring the input value which may be of any xs:duration type into the canonical form of xs:dayTimeDuration. This is achieved by removing the years and the months component from the duration value with subsequent canonisation.
If a xs:yearMonthDuration type has been passed on, it can be converted to the required xs:dayTimeDuration type – however, all of its components have the value 0, which is why the funtion consequentially returns the value 0 for the minutes component.
In order to achieve the canonical form PnDThHmMsS (with n optional, h, m, s < 60) of a xs:dayTimeDuration value passed on, all components on their own are put into canonical form. For this purpose, every single component is converted to integer values of the next greater component, whereby the residual value is maintained (example: PT130S becomes PT2M10S). For negative duration values, the returned value is accordingly negative.
Example 1 - minutes component from duration value:
Results in: 0.
The duration indication is in canonical form, but has no minutes component. In this case, it is set to 0 for the output.
Example 2 - value with minutes and seconds component:
Results in: 32.
Analogously to example 1 – here, apart from the days component also the components for hours and seconds are rejected.
Example 3 - duration value in non-canonical form:
Results in: 7.
The duration indication is not in canonical form. Firstly, the seconds component is converted to entire minutes and remaining seconds (2M3S; 2 minutes and 3 seconds). Therefore, 2 is added to the current minutes component of 5.
Example 4 - hours from negative duration value:
Results in: 10.
The duration indication is in canonical form, but is negative. Therefore, the value of the hours component (10H) is also returned with negative leading sign.
The function is not available.
fn:minutes-from-duration($arg as xs:duration?) as xs:integer?
|<< 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