[xsl] Generating a unique listing of elements from multiple sets

Subject: [xsl] Generating a unique listing of elements from multiple sets
From: Glen Mazza <grm7793@xxxxxxxxx>
Date: Wed, 24 Jan 2007 09:54:22 -0800 (PST)
Hello,

I have an XSLT 1.0 problem that I'm finding rather
difficult to solve.  I have a list of countries that
are placed into country groups, but countries may be
duplicated in multiple groups.  I also have a list of
businesses that have a listing of country groups that
they do business in.

For each business, I need a list of *unique* countries
affiliated with each business.

Sample input:

<data>
   <countries>
     <country id="1">United States</area>
     <country id="2">Canada</area>
     <country id="3">Mexico</area>
     ...
   </countries>
   <countryGroups>
	<countryGroup groupID="4">
		<country included="2"/>
		<country included="3"/>
	</countryGroup>
	<countryGroup groupID="5">
		<country included="3"/>
	</countryGroup>
	<countryGroup groupID="6">
		<country included="1"/>
		<country included="3"/>
	</countryGroup>
        ...
   </countryGroups>
   <businesses>
      <business>
	<name>Acme</name>	
	<countryGroup included="6"/>
      </business>
      <business>
	<name>Another Acme</name>
	<countryGroup included="4"/>
	<countryGroup included="5"/>
      </business>
      ...
   </businesses>
</data>

Desired output:
Acme              United States, Mexico
Another Acme      Canada, Mexico  [Mexico *not* listed
twice despite being in both groups defined for this
business]

Any help would be much appreciated!

Thanks,
Glen



 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

Current Thread