Re: [xsl] differences between x != 0 and not(x = 0)

Subject: Re: [xsl] differences between x != 0 and not(x = 0)
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 08 Jun 2005 10:41:06 -0400
At 2005-06-08 10:03 -0400, Jaime Stuardo wrote:
If I want to test that all nodes has value different from 0, I have to
use x!=0 or not(x=0) ?

Use not(x=0) to return true if all of the values are not equal to 0. The processor will walk through each node in set "x" and continue checking as long as the answer is false. "x=0" is false if x is non-zero, so it keeps checking the nodes in x. As soon as any is true, the comparison stops and true is returned, and the not() changes the true to false. If all of the tests are false, then false is returned and not() changes the false to true, implying that all of the nodes are not equal to zero because none of the nodes are equal to zero.


But be aware of what you want for the empty set "x", though. Do you want true or false? The comparison is initialized to false so if there are no nodes in "x" the comparison returns false and the not() returns true and you will get "all nodes different from 0" when you have no nodes ... you may not want that.

I hope this helps.

. . . . . . Ken


-- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread