RE: [xsl] Non-existing node

Subject: RE: [xsl] Non-existing node
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 17 Sep 2001 09:06:53 +0100
> I have a (stupid?) question:
> What is returned when you try to reach a node that doesn't exist ?

If you reference a node that doesn't exist, the result is an empty node-set.

> Imagine the simplest xml possible:
> <xml></xml>

Actually that's far from simple; it's highly debatable whether or not this
is well-formed XML, since the XML specification states that names beginning
with "xml" are reserved for future standardisation...
> what I would like to know is what value is returned if I try
> to reach some
> node inside the xml, thus is:
> ...
> <xsl:if test="SomeNode=Whatever">
> ...
> </xsl:if>
> ...

The rules for "=", "!=", etc, mean that if you compare an empty node-set to
anything, using any of the six comparison operators, the result is false. In
fact, comparing two empty node-sets to each other also gives false.

Mike Kay

 XSL-List info and archive:

Current Thread