R
richardkreidl
What I'd like to do is to check the values in an element if they're
greater than a certain time and if they are, then change the font color
of the time. I have about 10 elements that I will check against a
different time for each element, I'm just showing one element below in
my XML file. The time checking I have in the XSL file below works fine.
As you can see by my XSL file below I'm checking if this element
'LASTISA' if it's time is greater than 11:00 PM. And if it's before
11:00 PM the color will be green after 11:00 PM it would be orange.
Now, what I'd like to do is to check if the element has the text
'running' in it, if it does then I would like the 'running' text to be
in red. Example: <LASTISA>running</LASTISA>
I tried using another <xsl:when> and a <xsl:if> statement, but it
always defaults to the color green.
Any ideas???
Thanks
Rich
Part of my XML file:
<?xml version="1.0" standalone="yes"?>
<MSR>
<Info>
<LASTISA>11:01 PM Wednesday</LASTISA>
</Info>
</MSR>
Part of my XSL file:
<xsl:template match="LASTISA[. != '']">
<xsl:variable name="hours" select="number(substring-before(.,':'))"/>
<xsl:variable name="minutes"
select="number(substring(substring-after(.,':'),1,2))"/>
<xsl:variable name="PM" select="contains(.,'PM')"/>
<li>ISA DataBase ended at: <font><xsl:attribute name="color">
<xsl:choose>
<xsl:when test="$PM and ($hours >= 11) and ($minutes >
0)">#FF6600
</xsl:when>
<xsltherwise>#00008B
</xsltherwise>
</xsl:choose>
</xsl:attribute><xsl:value-of select="." /></font></li>
</xsl:template>
greater than a certain time and if they are, then change the font color
of the time. I have about 10 elements that I will check against a
different time for each element, I'm just showing one element below in
my XML file. The time checking I have in the XSL file below works fine.
As you can see by my XSL file below I'm checking if this element
'LASTISA' if it's time is greater than 11:00 PM. And if it's before
11:00 PM the color will be green after 11:00 PM it would be orange.
Now, what I'd like to do is to check if the element has the text
'running' in it, if it does then I would like the 'running' text to be
in red. Example: <LASTISA>running</LASTISA>
I tried using another <xsl:when> and a <xsl:if> statement, but it
always defaults to the color green.
Any ideas???
Thanks
Rich
Part of my XML file:
<?xml version="1.0" standalone="yes"?>
<MSR>
<Info>
<LASTISA>11:01 PM Wednesday</LASTISA>
</Info>
</MSR>
Part of my XSL file:
<xsl:template match="LASTISA[. != '']">
<xsl:variable name="hours" select="number(substring-before(.,':'))"/>
<xsl:variable name="minutes"
select="number(substring(substring-after(.,':'),1,2))"/>
<xsl:variable name="PM" select="contains(.,'PM')"/>
<li>ISA DataBase ended at: <font><xsl:attribute name="color">
<xsl:choose>
<xsl:when test="$PM and ($hours >= 11) and ($minutes >
0)">#FF6600
</xsl:when>
<xsltherwise>#00008B
</xsltherwise>
</xsl:choose>
</xsl:attribute><xsl:value-of select="." /></font></li>
</xsl:template>