xsl-list
[Top] [All Lists]

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

2007-01-24 10:54:37
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>