How to parse minutes from time in XSL & compare values?

Posted on 2010-01-07
Last Modified: 2013-11-18
I'm using XSL to generate a web page with formatted data.  my XML response retuns a field with a value of HH:MM:SS.  I want to check to see if the minute value is >2 and change a table background color based on the result of this test.

Let's say the xml loks like this:

How can I format XSL to read minute value, compare to see if >2  ( I can take care of setting class attribute to change background color once I get minute value)
Question by:juliemcnichols
    LVL 40

    Expert Comment

    LVL 60

    Accepted Solution

    I think you need a construct like this
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="" version="1.0">
    <xsl:template match="STATS">
            <xsl:attribute name="bgcolor">
                    <xsl:when test="number(substring-before(substring-after(WAITTIME, ':'), ':')) > 2">

    Open in new window


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now