[xsl] union and difference

Subject: [xsl] union and difference
From: "Steve Renshaw" <renshaw_steve@xxxxxxxxxxx>
Date: Sun, 13 May 2001 04:39:21 -0000
i have two sets in my xml{A,B,C,D} {C,D,E,F} and i want to get the intersections and those elements in 1st set but not 2nd. but
there are two ways in examples to get result in example but only i can get one working. The 1st intersection method has not results
and the elements in 1st but not 2nd. Why does method with count not work


<xsl:template match="Sets">
	<xsl:variable name="set1" select="set1"/>
	<xsl:variable name="set2" select="set2"/>
	Intersection #1={
	<xsl:for-each select="$set1[count(.|$set2)=count($set2)]">
 		<xsl:value-of select="."/><br/>
	</xsl:for-each>}
	Intersection #2={
	<xsl:for-each select="$set1[. = $set2]">
 		<xsl:value-of select="."/>.
	</xsl:for-each>}
	<xsl:variable name="set2" select="set2"/>
	In $set1 but not $set2 #1={
	<xsl:for-each select="$set1[count(.|$set2)!=count($set2)]">
		<xsl:value-of select="."/>,
	</xsl:for-each>}
	In $set1 but not $set2 #2={
	<xsl:for-each select="$set1[not(. = $set2)]">
		<xsl:value-of select="."/>,
	</xsl:for-each>}
</xsl:template>

<Sets>
<set1>A</set1><set1>B</set1><set1>C</set1><set1>D</set1>
<set2>C</set2><set2>D</set2><set2>E</set2><set2>F</set2>
</Sets>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


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



Current Thread