2016-09-15 160 views
-3

我有以下持续时间持续时间计算

<EstimatedTime> 
    <Value>PT0H3M05S</Value> 
</EstimatedTime> 

预期的输出是

03.05

任何想法,请。

+0

您需要使用XSLT字符串函数解析字符串... http://zvon.org/xxl/XSLTreference/Output /xpathFunctionIndex.html –

+0

通过搜索找到解决方案:[answer](http://stackoverflow.com/questions/14955794/use-of-xsd-duration-type-using-xslt-to-out-put-value- to-normal-duartion-format) – uL1

回答

0

如果您的处理器支持XSLT 2.0,你可以使用:

<xsl:template match="EstimatedTime"> 
    <xsl:value-of select="format-number(minutes-from-duration(Value), '00')"/> 
    <xsl:text>.</xsl:text> 
    <xsl:value-of select="format-number(seconds-from-duration(Value), '00')"/> 
</xsl:template> 
+0

这就是我想要收到的,谢谢 –