This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Non-existing node
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Non-existing node
- From: "Casadome, Francisco Javier" <Francisco dot Casadome at bowneglobal dot es>
- Date: Mon, 17 Sep 2001 10:54:48 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
> If you reference a node that doesn't exist, the result is an empty
node-set.
I completely agree :)
> 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...
You got me there... I didn't mean to use "xml" by any particular reason
I was just trying to make it as general as possible :)
> 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.
Ok, but the parser has to compare against something, so my question is
if there's any reserved word or something to refer to an empty-nodeset.
Let's say the reserved word is "ENS" (Empty Node Set), that way you could
write something like this:
<xsl:if test="Parent/MyNode=ENS">...</xsl:if>
To select all "Parent" nodes that don't have a "MyNode" child.
Maybe it's just me... sometimes I just can't see the easy way to solve
problems :)
Thanks,
Frank.
-----Original Message-----
From: Michael Kay [mailto:mhkay@iclway.co.uk]
Sent: lunes, 17 de septiembre de 2001 10:07
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] Non-existing node
> 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: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list