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:27:19 +0100
> now i want how to get particular employees covered  between 
> two different
> date of join date(example Fromdate and Todate ).
> 
> please tell the me Xpath / XSL expression.

If the source documents have a schema, and the attributes are defined in the
schema as being of type xs:date, and you are using a schema-aware XSLT 2.0
processor, then you can just write

employee[@FromDate le $d and @ToDate ge $d]

If you are not using a schema, but you are using XSLT 2.0, and your dates
are stored in the ISO 8601 format that XML Schema uses, then you can still
do the same kind of comparison but you need to do a little more work:

employee[xs:date(@FromDate) le $d and xs:date(@ToDate) ge $d]

If you are not using a schema and your dates are in some other format, or if
you are using XSLT 1.0, then you will need to do even more work, but this
then depends entirely on the format you are starting with.

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

Current Thread