xsl-list
[Top] [All Lists]

Re: Testing against node-set

2003-02-06 07:55:27
Hi Nadia,

<xsl:for-each
select="$secondRowSet[parentID!=$firstRowSet/@id]">

The problem is that you've used ...!=... when you want to use
not(...=...).

When you use a node set with != it tests whether *any* of the nodes in
that node set fulfil the condition that you're testing. So the above
gets those rows that (a) have a parentID and (b) have a parentID whose
value is not equal to one of the IDs from the first row set.

This doesn't select your row 3 because row 3 doesn't have a parentID.
It does select your row 4 because row 4 has a parentID of 1, and 1 !=
2, which is the id of one of the rows in the first row set.

If you instead use:

  $secondRowSet[not(parentID = $firstRowSet/@id)]

then it will select those rows that don't have a parentID (because
then there's no parentID to be equal to an ID from the first row set)
and not select those who have a parentID whose value is equal to *any*
of the IDs from the first row set.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>