This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Filtering Child Elements Between Two Values


Hello, John.

Sendrey, John wrote:
> I'm using the following:
> 
> <xsl:for-each select="students/student[($stopdate >=
> certifications/certification/date) and 
(certifications/certification/date >=
> $startdate)]">

Use this instead:

<xsl:for-each select="students/student[
  certifications/certification/date[$stopdate>=. and .>=$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?

-- 
Alexander E. Gutman

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]