Processing an Integer Retrieved from a String in XSL
        Posted  
        
            by justkt
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by justkt
        
        
        
        Published on 2010-05-03T17:02:20Z
        Indexed on 
            2010/05/03
            17:08 UTC
        
        
        Read the original article
        Hit count: 309
        
xsl
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.
© Stack Overflow or respective owner