<xsl:function name="functx:timezone-from-duration" as="xs:string"
xmlns:functx="http://www.functx.com">
<xsl:param name="duration" as="xs:dayTimeDuration"/>
<xsl:sequence select="
if (string($duration) = ('PT0S','-PT0S'))
then 'Z'
else if (matches(string($duration),'-PT[1-9]H'))
then replace(string($duration),'PT([1-9])H','0$1:00')
else if (matches(string($duration),'PT[1-9]H'))
then replace(string($duration),'PT([1-9])H','+0$1:00')
else if (matches(string($duration),'-PT1[0-4]H'))
then replace(string($duration),'PT(1[0-4])H','$1:00')
else if (matches(string($duration),'PT1[0-4]H'))
then replace(string($duration),'PT(1[0-4])H','+$1:00')
else error(xs:QName('functx:Invalid_Duration_Value'))
"/>
</xsl:function>
|