Posted By:
Jijo_Thomas
Posted On:
Monday, June 28, 2004 04:01 AM
I have a collection of objects say, Friends. I need to write an XSL that fetches me only the first friend who satisfies a condition. ie, I need only the first friend (from my list) who has scored an A+ in History test. Example : Here is a list of my friends with their grades in History test. Andy B Michael B+ Susan A+ George A+
More>>
I have a collection of objects say, Friends. I need to write an XSL that fetches me only the first friend who satisfies a condition. ie, I need only the first friend (from my list) who has scored an A+ in History test.
Example :
Here is a list of my friends with their grades in History test.
Andy
B
Michael
B+
Susan
A+
George
A+
Jack
B
Jeniffer
B
I need to write an XSL that would chose the first friend in the list who has scored an A+ in History test.
Java Equivalent
I would done it in java as follows
boolean friendFound = false;
....
while (myFriendsItr.hasNext() && ! friendFound) {
friend = (Friend) myFriendsItr.next();
if (friend.getGradeHistory().equals("A+")) {
friendFound = true;
}
}
....
Problem in using this logic with XSL
Since values of variables once set in XSL can not be updated, i can not use this logic in XSL. Is there any way by which i can solve my problem using XSl?
<<Less