Subject: RE: Non-existing node
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 17 Sep 2001 14:09:40 +0100
|
> 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>
>
"=" doesn't compare the node-set with anything, it compares each node in the
node-set individually, and returns true if any of the comparisons is true.
To test whether a node-set Parent/MyNode is empty, just do
<xsl:if test="Parent/MyNode">: converting a node-set to a boolean returns
true if the node-set is non-empty.
There's no reserved word to refer to an empty node-set; if you need to write
an expression that represents an empty node-set, try:
<xsl:variable name="empty" select="/.."/>
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: Non-existing node, (continued)
- David Carlisle - Mon, 17 Sep 2001 05:47:40 -0400 (EDT)
- David Carlisle - Mon, 17 Sep 2001 05:49:47 -0400 (EDT)
- Chris Bayes - Mon, 17 Sep 2001 05:56:25 -0400 (EDT)
- Francis Norton - Mon, 17 Sep 2001 06:08:04 -0400 (EDT)
- Michael Kay - Mon, 17 Sep 2001 09:15:23 -0400 (EDT) <=
- Casadome, Francisco Javier - Mon, 17 Sep 2001 06:23:12 -0400 (EDT)
- Casadome, Francisco Javier - Mon, 17 Sep 2001 06:32:27 -0400 (EDT)
- Casadome, Francisco Javier - Mon, 17 Sep 2001 13:21:48 -0400 (EDT)
|
|