4
xslt 1.0中是否有更优雅的解决方案?我知道有内置的函数为xslt 2.0。将十进制小时转换为小时分秒
我在十进制小时内取一个数字,需要将其表示为HH:MM:SS。目前我有以下功能。
<xsl:variable name="decimal_hours" select="pre_lab_cost div pre_labour_rate"/>
<xsl:variable name="decimal_minutes" select="number(concat('0.',substring-after($decimal_hours, '.')))*60"/>
<xsl:variable name="decimal_seconds" select="number(concat('0.',substring-after($decimal_minutes, '.')))*60"/>
<xsl:value-of select="concat(format-number(floor($decimal_hours), '00'),
':',
format-number(floor($decimal_minutes), '00'),
':',
format-number(floor($decimal_seconds), '00')
)"/>
我喜欢它,没有考虑一个MOD这在事后看来是愚蠢的。 – Horba 2012-08-13 16:49:44