RE: Union and descendants: count(.//name1|name2) ? Doesn't perfor m Union?

Subject: RE: Union and descendants: count(.//name1|name2) ? Doesn't perfor m Union?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 13 Jul 1999 09:52:22 +0100
> 
> count(.//entry|e) 
> 
> Returns only the number of "entry" elements without adding 
> the number of e matches to the result.

This parses as count( (.//entry) | (e) )
and should return the sum of the number of descendant "entry" elements and
the number of child "e" elements. If you want to include descendant "e"
elements, write

count(.//entry | .//e)

or (probably more efficient, because a union involves elimination of
duplicates, which is not actually needed here)

count(.//entry) + count(.//e)
 
> 
> count(./e|entry) 
> 
> Works fine, counting both

It will, because this expression is equivalent to

count((./e) | (./entry))

Mike Kay


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


Current Thread