Here is my XML file:
<?xml version="1.0" standalone="yes"?>
<MSR>
<Info>
<TODAY>Saturday, January 29, 2005</TODAY>
<SSEC>4:00 pm</SSEC>
</Info>
</MSR>
My XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="version="1.0">
<xsl
utput method="html" indent="yes" />
<xsl:template match="/">
<html>
<head>
<style type="text/css">
body {background-color:#f5f5f5}
h1 {text-align:center}
h4 {color:Blue;font-size:small;text-align:center}
li {font-weight:bold}
</style>
</head>
<body>
<H1>Status Report</H1>
<xsl:apply-templates select="MSR/Info"/>
</body>
</html>
</xsl:template>
<xsl:template match="Info">
<xsl:choose>
<xsl:when test="(string-length(SSEC)">
<H4><xsl:apply-templates select="TODAY"/></H4>
</xsl:when>
<xsl
therwise>
<H4><xsl:apply-templates select="TODAY"/></H4>
<H4><xsl:text>No Current Updates</xsl:text></H4>
</xsl
therwise>
</xsl:choose>
<xsl:if test="(SSEC !='')">
<h3>Securities</h3>
<xsl:apply-templates select="SSEC"/>
</xsl:if>
</xsl:template>
<xsl:template match="TODAY[. != '']">
<h4>Cycle Run Of: <font color="#00008B"><xsl:value-of select="."/></font></h4>
</xsl:template>
<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle ended at: <font><xsl:attribute name="color">
<xsl:variable name="hours" select="number(substring-before(.,':'))"/>
<xsl:variable name="minutes" select="number(substring(substring-after(.,':'),1,2))"/>
<xsl:variable name="AM" select="contains(.,'AM')"/>
<xsl:variable name="AM1" select="contains(.,'am')"/>
<xsl:choose>
<xsl:when test="((($AM or $AM1) and ($hours = 12) and ($minutes >= 0)) or (($AM or $AM1) and ($hours >= 2) and ($minutes > 30)) or (($AM or $AM1) and ($hours > 2) and ($minutes >= 0)))">#800000
</xsl:when>
<xsl
therwise>#00008B
</xsl
therwise>
</xsl:choose>
</xsl:attribute><xsl:value-of select="." /></font></li>
</xsl:template>
<xsl:template match="*"/>
</xsl:stylesheet>
Cuurrently the XML file node 'TODAY' has the date of: <TODAY>Saturday, January 29, 2005</TODAY>
I found this XSL script that gets the system date but I'm not sure how to incorporate it in my XSL file above and compare the dates in the XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="version="1.0">
<xsl:script>
<![CDATA[
function retDate( )
{
var now = new Date();
return now;
}
]]>
</xsl:script>
<xsl:eval>retDate() </xsl:eval>
</xsl:stylesheet>
Here's what I need to do --- if the system date is greater than the 'TODAY' date by 2 days example: '<TODAY>Saturday, January 29, 2005</TODAY>
System date: Monday, January 30, 2005
Then I would want to use the following template for 'SSEC': then the one above which parses out the time and changes the font color depending what time it is.
<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle ended at: <font color="black"><xsl:value-of select="." /></font></li>
</xsl:template>
I hope my explanation of the problem is good enough.
Thanks
<?xml version="1.0" standalone="yes"?>
<MSR>
<Info>
<TODAY>Saturday, January 29, 2005</TODAY>
<SSEC>4:00 pm</SSEC>
</Info>
</MSR>
My XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="version="1.0">
<xsl
<xsl:template match="/">
<html>
<head>
<style type="text/css">
body {background-color:#f5f5f5}
h1 {text-align:center}
h4 {color:Blue;font-size:small;text-align:center}
li {font-weight:bold}
</style>
</head>
<body>
<H1>Status Report</H1>
<xsl:apply-templates select="MSR/Info"/>
</body>
</html>
</xsl:template>
<xsl:template match="Info">
<xsl:choose>
<xsl:when test="(string-length(SSEC)">
<H4><xsl:apply-templates select="TODAY"/></H4>
</xsl:when>
<xsl
<H4><xsl:apply-templates select="TODAY"/></H4>
<H4><xsl:text>No Current Updates</xsl:text></H4>
</xsl
</xsl:choose>
<xsl:if test="(SSEC !='')">
<h3>Securities</h3>
<xsl:apply-templates select="SSEC"/>
</xsl:if>
</xsl:template>
<xsl:template match="TODAY[. != '']">
<h4>Cycle Run Of: <font color="#00008B"><xsl:value-of select="."/></font></h4>
</xsl:template>
<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle ended at: <font><xsl:attribute name="color">
<xsl:variable name="hours" select="number(substring-before(.,':'))"/>
<xsl:variable name="minutes" select="number(substring(substring-after(.,':'),1,2))"/>
<xsl:variable name="AM" select="contains(.,'AM')"/>
<xsl:variable name="AM1" select="contains(.,'am')"/>
<xsl:choose>
<xsl:when test="((($AM or $AM1) and ($hours = 12) and ($minutes >= 0)) or (($AM or $AM1) and ($hours >= 2) and ($minutes > 30)) or (($AM or $AM1) and ($hours > 2) and ($minutes >= 0)))">#800000
</xsl:when>
<xsl
</xsl
</xsl:choose>
</xsl:attribute><xsl:value-of select="." /></font></li>
</xsl:template>
<xsl:template match="*"/>
</xsl:stylesheet>
Cuurrently the XML file node 'TODAY' has the date of: <TODAY>Saturday, January 29, 2005</TODAY>
I found this XSL script that gets the system date but I'm not sure how to incorporate it in my XSL file above and compare the dates in the XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="version="1.0">
<xsl:script>
<![CDATA[
function retDate( )
{
var now = new Date();
return now;
}
]]>
</xsl:script>
<xsl:eval>retDate() </xsl:eval>
</xsl:stylesheet>
Here's what I need to do --- if the system date is greater than the 'TODAY' date by 2 days example: '<TODAY>Saturday, January 29, 2005</TODAY>
System date: Monday, January 30, 2005
Then I would want to use the following template for 'SSEC': then the one above which parses out the time and changes the font color depending what time it is.
<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle ended at: <font color="black"><xsl:value-of select="." /></font></li>
</xsl:template>
I hope my explanation of the problem is good enough.
Thanks