[xsl] grouping references so that they only appear once

Subject: [xsl] grouping references so that they only appear once
From: "Rick Geimer" <Rick.Geimer@xxxxxxx>
Date: Wed, 28 May 2003 16:01:48 -0700
Hello,

I have a grouping problem that I am hoping someone can help me with.
Imagine that I am transforming the following instance, and that I am
currently processing the category element with  the id "shoes".

<?xml version="1.0"?>
<doc>
      <categories>
            <category id="shoes">Shoes</category>
            <category id="clothes">Clothing (General)</category>
      </categories>

      <makers>
            <maker id="nike">Nike</maker>
            <maker id="rebok">Rebok</maker>
      </makers>

      <products>
            <product>
                  <name>Shoe1</name>
                  <categoryRef idref="shoes"/>
                  <categoryRef idref="clothes"/>
                  <makerRef idref="nike"/>
            </product>
            <product>
                  <name>Shoe2</name>
                  <categoryRef idref="shoes"/>
                  <categoryRef idref="clothes"/>
                  <makerRef idref="nike"/>
            </product>
            <product>
                  <name>Shoe3</name>
                  <categoryRef idref="shoes"/>
                  <categoryRef idref="clothes"/>
                  <makerRef idref="rebok"/>
            </product>
      </products>
</doc>

I want to get a list of all the makers that have products that reference
the shoes category, but I don't want a single maker to appear more than
once. I have been able to use keys to gather a list of products that
reference a category, and from there I can get the makerRefs, and with
another set of keys I can then get the makers, but I can't see how to
ensure that each maker is only listed once since multiple products
reference the same makers.

Any help would be appreciated.

Rick




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


Current Thread