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

[xsl] Filtering Child Elements Between Two Values


Subject: [xsl] Filtering Child Elements Between Two Values
From: "Sendrey, John" <jsendrey@xxxxxxxxxxx>
Date: Mon, 13 Aug 2001 21:04:54 -0700

I'm using the following:

<xsl:for-each select="students/student[($stopdate >=
certifications/certification/date) and (certifications/certification/date >=
$startdate)]">

to locate all students who have a certification date between $startdate and
$stopdate, inclusive ( YYYYMMDD format )

<students>
  <student>
    <certifications>
      <certification>
        <date>20010701</date>
        <name>MCP</name>
      </certification>
      <certification>
        <date>20010801</date>
        <name>MCSE</date>
      </certification>
    </certifications>
  </student>
  .
  .
  .
</students>

However, in my results, I get the student returned if I choose $startdate =
'20010708' and $stopdate = '20010721' even though neither of the two dates
in the sample data above appears between this date range.  It appears to be
selecting the student because at least one date is greater than '20010708'
and at least one date is less than '20010721' even though neither date falls
in between the two date values.  How can I select a student only if he/she
has at least one certification date that falls in between $startdate and
$stopdate?

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread