|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: union and difference
Your definitions for $set1 and $set2: <xsl:variable name="set1" select="set1"/> <xsl:variable name="set2" select="set2"/> will always result in *disjoint* node-sets. $set1 contains the first four <set1> nodes while $set2 contains the first four <set2> nodes. Since a <set1> node is always distinct from a <set2> nodes, these two node-sets will never have any nodes in common. Therefore, when you attempt set intersection with select="$set1[count(.|$set2)=count($set2)]"> you get an empty node-set and when you attempt set difference with select="$set1[count(.|$set2)!=count($set2)]"> you get all four nodes in $set1. The situation is different when you use select="$set1[. = $set2]" select="$set1[not(. = $set2)]" Here you are comparing the *text* values of the nodes in node-sets $set1 and $set2. The first select statement returns the nodes in $set1 (ie <set1> nodes) which have the same text value as nodes in node-set $set2. The second select statement returns the nodes in $set1 which do not have the same text value as nodes in node-set $set2. You might contrast these two select statements with the following: select="$set2[. = $set1]" select="$set2[not(. = $set1)]" These statements while having similar set logic, return nodes in $set2 (ie <set2> nodes) not nodes in $set1 (ie <set1> nodes). Finally, I am not sure I agree with another reply with regard to merging of text nodes. I beleive the following definition of $set1 will in fact have four distinct nodes: <xsl:variable name="set1" select="set1/text()"/> <xsl:value-of select="count($set1)"/> Adjacent text nodes get merged on occassion but perhaps some could clarify precisely when this happens as I am not 100% certain. Regards, Dan __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








