This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Standard XPath expression for the intersection of two node se ts (Was: RE: How can I test if an node included in a nodeset)
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Standard XPath expression for the intersection of two node se ts (Was: RE: How can I test if an node included in a nodeset)
- From: Ed Blachman <EdB at trellix dot com>
- Date: Fri, 4 Aug 2000 14:22:33 -0400
- Reply-To: xsl-list at mulberrytech dot com
I think the answer here is that in some sense you're both right, but Oliver
is closer to standard usage:
http://mathworld.wolfram.com/SetDifference.html defines "set difference" in
a manner that matches Oliver's expression; it references in addition
something the "symmetric difference" of two sets
(http://mathworld.wolfram.com/SymmetricDifference.html) which matches Ken's
expression.
-- ed
> -----Original Message-----
> From: G. Ken Holman [mailto:gkholman@CraneSoftwrights.com]
> Sent: Friday, August 04, 2000 12:31 PM
> To: xsl-list@mulberrytech.com
>
> At 00/08/04 10:59 +0200, Oliver Becker wrote:
> >I don't know if anybody has mentioned this before:
> >
> >If we add a single exclamation mark
> > $nodes1[count(.|$nodes2)!=count($nodes2)]
> >it will become the difference of the two node-sets $nodes1
> and $nodes2.
>
> I disagree, though I thought the same at first when saw
> Mike's great post
> ... what you have will be those in $nodes1 not in $nodes2,
> but not those in
> $nodes2 not in $nodes1.
>
> I figured you would need:
>
> ( $ns1[count(.|$ns2)!=count($ns2)]
> | $ns2[count(.|$ns1)!=count($ns1)] )
>
> to get the true difference as I understand it, that being all
> nodes in both sets not in the other set. I have an example below.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list