2016-09-15 162 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

這就是我想要收到的,謝謝 –