Name
[2.0]
minutes-from-duration()
Given an xs:duration value,
returns the number of minutes in that duration.
Syntax
xs:integer?minutes-from-duration(xs:duration?)
Inputs
An xs:duration
value.
Output
An xs:integer
representing the minutes component of the given xs:duration. Be aware that for an
xs:yearMonthDuration, this
function always returns 0
because there is no minutes component of an xs:yearMonthDuration. Also, if the
argument is the empty sequence, this function returns the empty
sequence.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 10.5, “Component Extraction Functions on Durations, Dates and Times.”
Example
This stylesheet demonstrates the minutes-from-duration() function
with all three types of durations:
<?xml version="1.0"?>
<!-- minutes-from-duration.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>
Extracting the minutes component from durations:</xsl:text> <xsl:variable name="sampleDuration" as="xs:duration" select="xs:duration('P3Y8M2DT4H23M12.2S')"/> <xsl:variable name="sampleYearMonthDuration" as="xs:yearMonthDuration" select="xs:yearMonthDuration('P3Y8M')"/> <xsl:variable name="sampleDayTimeDuration" as="xs:dayTimeDuration" select="xs:dayTimeDuration('P2DT4H23M12.2S')"/> <xsl:text>

 A sample xs:duration: </xsl:text> <xsl:value-of select="$sampleDuration"/> <xsl:text>
 The minutes component ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access