[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

union and difference

Subject: union and difference
From: "Steve Renshaw" <renshaw_steve@xxxxxxxxxxx>
Date: Sun, 13 May 2001 04:39:21 -0000
select union difference
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.