[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Non-existing node

Subject: RE: Non-existing node
From: "Casadome, Francisco Javier" <Francisco.Casadome@xxxxxxxxxxxxxx>
Date: Mon, 17 Sep 2001 10:54:48 +0200
comparison operators in xsl
> 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@xxxxxxxxxxxx]
Sent: lunes, 17 de septiembre de 2001 10:07
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.