RE: [xsl] get Data BETWEEN FromDate and ToDate

Subject: RE: [xsl] get Data BETWEEN FromDate and ToDate
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 20 May 2005 14:32:32 +0100
> <Employees>
> <Employee Empname="Raj" Empname="Raj" DOJ ="02/04/2005"   
> SftTime="0030"
> >
> <Employee Empname="Rajkumar" DOJ ="02/04/2005"   SftTime="0030"     >
> <Employee Empname="Raja" DOJ ="03/04/2005"   SftTime="0000"     >
> <Employee Empname="Ravi" DOJ ="04/04/2005"   SftTime="2330"     >
> <Employee Empname="john" DOJ ="05/04/2005"   SftTime="1600"     >
> <Employee Empname="gopi" DOJ ="06/04/2005"   SftTime="0100"     >
> <Employee Empname="ajith" DOJ ="13/04/2005"   SftTime="2200"     >
> </Employees>
> 
> i want to filter only employees in DOJ between 05/04/2005 and 
> 13/04/2005
> these date. thatsall.

It looks as if your dates are in the format dd/mm/yyyy, which although more
logical than the form mm/dd/yyyy, still does not sort naturally.

With XSLT 1.0, the technique is to convert the dates to numbers like this:

number(concat(substring(x, 7, 4), substring(x, 4, 2), substring(x, 1, 2)))

and then compare the numbers.

(This is assuming the month and day are always two digits: I shouldn't
really assume that simply because it's true for the six records shown
above).

Michael Kay
http://www.saxonica.com/

Current Thread