• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

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

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)
1 Solution
Gurvinder Pal SinghCommented:
Geert BormansCommented:
I think you need a construct like this
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now