XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Sushant PrabhuSubject: 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.

Do let me know your suggestions


Thanks

Posttop
Tony LavinioSubject: 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.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.