Subject: [xsl] Comparing Integers From: "Aaron Johnson" <artpunx@xxxxxxxxx> Date: Wed, 17 Oct 2007 17:55:10 +0100 |
Hello... I have set up some tests to compare Integers, but wish to refine the comparison. I have some xml: <submissionDeadline>2027-10-04T09:00:00.0000000-00:00</submissionDeadline> <submissionDeadline>2007-10-03T09:00:00.0000000-00:00</submissionDeadline> <submissionDeadline>2007-10-01T08:00:00.0000000+01:00</submissionDeadline> <submissionDeadline>2007-09-10T12:00:00.0000000+01:00</submissionDeadline> This is selected and concatenated into an integer: <xsl:variable name="submissionDeadlineString" select="concat(substring(submissionDeadline, 1,4)... etc etc I then concatenate the current time / date etc: <xsl:variable name="currentTime">2007-10-04T09:00:00.0000000+01:00</xsl:variable> <xsl:variable name="currentTimeString" select="concat(substring($currentTime, 1,4)....etc etc ...then test against each other: <xsl:when test="$currentTimeString < = $submissionDeadlineString"><xsl:call-template name="ontime"/></xsl:when> I would like to be able to test for 4 different outcomes, ontime, within24Hours, within10Days and past10Days. I have set up variable and tests thus far: <xsl:variable name="currentTime">2007-10-04T09:00:00.0000000+01:00</xsl:variable> <xsl:variable name="currentTimeString" select="concat(substring($currentTime, 1,4)....etc etc <xsl:variable name="within24Hours" select="number($submissionDeadlineString + 1000000)"/> <xsl:variable name="within10Days" select="number($submissionDeadlineString + 1000001)"/> <xsl:variable name="past10Days" select="number($submissionDeadlineString + 10000001)"/> <xsl:choose> <xsl:when test="$currentTimeString < = $submissionDeadlineString"><xsl:call-template name="ontime"/></xsl:when> <xsl:when test="$currentTimeString < = $within24Hours"><xsl:call-template name="twentyFourHourRule"/></xsl:when> <xsl:when test="$currentTimeString < = $within10Days"><xsl:call-template name="tenDayRule"/></xsl:when> <xsl:when test="$currentTimeString > = $past10Days"><xsl:call-template name="plusTenDay"/></xsl:when> </xsl:choose> ...so far, only the "ontime" and "plusTenDay" tests work. Am I headed in the right direction? Can anyone offer any advice please? Thank you.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] DOCTYPE public and system, Michael Tracey Zellm | Thread | RE: [xsl] Comparing Integers, Michael Kay |
RE: [xsl] DOCTYPE public and system, Michael Kay | Date | RE: [xsl] Comparing Integers, Michael Kay |
Month |