On 13 Sep 2002, Craig Longman wrote:

>   <x:if select="$mod/module-load-status == '${selector}'">
> 
> notice the '==' as equality check, not '=' as assignment.  i'm pretty
> sure that a (at least one) problem.

No, in XPath, '=' is the operator to test for equality; '==' is not used.

Note, just as an interesting sidebar, that '=' is one of the least
intuitive operators in XPath when applied to node-sets.  It does not test
for set equality, as you might expect; instead, it performs an odd
convert-then-intersect operation as follows:

  If both objects to be compared are node-sets, then the comparison will
  be true if and only if there is a node in the first node-set and a node
  in the second node-set such that the result of performing the comparison
  on the string-values of the two nodes is true.

I still can't figure out what use-case the designers of XPath or XSLT had
in mind when specifying the operator this way.  It means, for instance,
that in the following document, the expression "//a = //b" is true:

 <root>
  <a>1</a>
  <b>2</b>
  <b>1</b>
 </root>

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to