Subject:and opernd not working with Author:Sushant Prabhu Date:02 Jan 2007 08:33 PM
Hi All,
I am trying to evaluate a scenario where in i have to check for equality of 2 test conditions & only then proceed.
Here is what I have in my xsl file
<xsl:if test="item_name !='Geography' and
($obj_id != '4' or $obj_id !='6')">
Now the condition I want to implement is when item_name is not Geography AND obj_id is not (4 or 6) then proceed with the body of if condition.
In other words if teh item_name is Geography and obj_id is either 4 or 6 then also the if condition executes.
The behaviour i am getting is it straight away ignores all item_names where item_nam =Geography.
I want both the conditions to satisfy hence used the AND operator.
Subject:and opernd not working with Author:Tony Lavinio Date:03 Jan 2007 09:43 AM
The phrase ($obj_id != '4' or $obj_id !='6') will always
evaluate to true.
If $obj_id is '4', then it is != '6', so it is true by the
second half. If $obj_id is '6', then it is != '4', so it
is true by the first half. If it is neither '4' nor '6',
then it is true by both halves.
Try ($obj_id != '4' and $obj_id !='6') instead. When you
invert logic, watch for the and/or inversion also.