RE: [xsl] XPath: all elements with only non-parent children with identical style attr

Subject: RE: [xsl] XPath: all elements with only non-parent children with identical style attr
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 13 Dec 2001 22:04:37 -0000
> >     not(*/@style != */@style)]
>
> Hi Tobias, Jeni:
>
> maybe a dumb question but why all the "not"s (and writhing
> and fainting in
> coils?)
> wouldn't
 ... (*/@style = */@style)]
> work the same way?

Not the same thing at all!

A != A, where A is a node-set, is true if there is some node in A that is
unequal to another node in A. So "not(A != A)" is true if all the nodes in A
have the same string value (brilliant, Jeni!). While "A = A", of course, is
true if any node in A has the same value as some node in A - which will
always be true, so long as A is not empty, because every node is equal to
itself.

(This is actually the first time I have ever seen A != B, where the operands
are both multi-node node-sets, used for a serious purpose; perhaps I will
have to reconsider my previous assumption that it wasn't worth optimising!).

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread