Processing an Integer Retrieved from a String in XSL
- by justkt
I have a stored time value which is of the format H:mm:ss. The hours may be any value from 0 up through several days. This data is sent in an XML tag and processed by XSL to be displayed. The display that I want is of the format:
D days, HH:mm:ss (hours/minutes)
Where the last tag shows hours if HH is greater than 0, minutes if it is 0.
Given the original HH, which may be more than 24, I know I need the floor of HH / 24 to get the days value. Then the original HH % 24 gives me the leftover hours.
I have also handled the minutes and hours question using xsl:when and xsl:if.
It's getting days and hours from the hours value that has me stumped.