[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] get Data BETWEEN FromDate and ToDate


Subject: Re: [xsl] get Data BETWEEN FromDate and ToDate
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Sat, 21 May 2005 03:27:36 -0700 (PDT)

Hi Amburose,
  I was thinking how to solve this problem rightly..
Before you try my stylesheet, please study Michael
Kay's answer (it will surely be better than mine :)
)..

Here is the XSLT stylesheet -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indent="yes" />

<xsl:variable name="date1" select="'04-03-2005'" />
<xsl:variable name="date2" select="'04-05-2005'" />

<xsl:template match="/Employees">
     <result>
         <xsl:for-each select="Employee"> 
             <xsl:variable name="doj"
select="concat(substring(@DOJ,4,2),'-',substring(@DOJ,1,2),'-',substring(@DOJ,7,4))"
/> 
                 <xsl:if test="($doj &gt;= $date1) and
($doj &gt;= $date1)">
                    <xsl:copy-of select="." />
            </xsl:if>
        </xsl:for-each>
    </result>
</xsl:template>

</xsl:stylesheet>

This is an XSLT 2.0 stylesheet , and tested with Saxon
8.4 XSLT processor.

Regards,
Mukul

--- Amburose <ambrose@xxxxxxxxxxxxx> wrote:
> 
> hi,
> 
> i have one xml file. that contain number of
> employess records with basic
> informations like name, age, date of joining ....
> 
> 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.
> 
> 
> Best Wishes,
> amburose

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Current Thread
Keywords