[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Comparing node for identity using union

Subject: RE: [xsl] Comparing node for identity using union
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 13 Jan 2005 23:38:07 -0000

> I run to the debuger i see that
> (count(parent::Menu|$snode)=1) is allways true, even when $snode no
> node, and even when there is no parent::Menu .

count(A|B)=1 will be true if A contains one node and B is empty, or if B
contains one node and A is empty, or if both A and B contain a single node
and this is the same node.

This is only a safe test for identity if you know that each of the node-sets
A and B is a single node. If you're not sure of that, a safer test is

count(A)=1 and count(B)=1 and count(A|B)=1

Michael Kay

Current Thread