The following finally works for me,
<xsl:function name="fn0:minsFromdiffDTduration" as="xs:decimal">
<xsl:param name="diffDTduration" as="xs:dayTimeDuration"/>
<xsl:variable name="yrsDuration"
select="years-from-duration($diffDTduration)"/>
<xsl:variable name="mnthsDuration"
select="months-from-duration($diffDTduration)"/>
<xsl:variable name="daysDuration"
select="days-from-duration($diffDTduration)"/>
<xsl:variable name="hrsDuration"
select="hours-from-duration($diffDTduration)"/>
<xsl:variable name="mnsDuration"
select="minutes-from-duration($diffDTduration)"/>
<xsl:variable name="secsDuration"
select="seconds-from-duration($diffDTduration)"/>
<xsl:variable name="totalSecs" select="$yrsDuration * 365 * 24 * 60 +
$mnthsDuration * 30 * 24 * 60 +
$daysDuration * 24 * 60 + $hrsDuration * 60 + $mnsDuration +
$secsDuration div 60" />
<xsl:sequence select="$totalSecs"/>
</xsl:function>
This seems very convoluted. For a start, it assumes that every month is 30
days long, though this error doesn't really matter since your input is a
dayTimeDuration so the number of years and months will always be zero. But
there's a much simpler way of doing it (which I'm sure has been suggested):
divide the supplied dayTimeDuration by xs:dayTimeDuration('PT1S') (using the
div operator) to get the number of seconds.
Michael Kay
Saxonica
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--