[xsl] Generating a collection of unique elements.

Subject: [xsl] Generating a collection of unique elements.
From: Nathan Potter <ndp@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Jun 2008 09:50:53 -0700
Greetings,

I have thought about this for a couple of days, and I don't really have an ideas about how to get the result I want. Maybe someone here can help!

In my source document there are a number of <foo> elements. They all have a "name" attribute. They can occur as child elements of any other element in the document, at any level of nesting.

My XSL needs to process these <foo> elements and produce a list of the unique names.

Source Example:

<doc>
    <foo name="a" />
    <foo name="d" />


<thing1> <foo name="a" /> <foo name="b" /> <foo name="c" /> </thing1>

    <thing2>
            <foo name="a" />
        <thing3>
            <foo name="b" />
            <foo name="c" />
        </thing3>
            <foo name="d" />
            <foo name="e" />
    </thing2>
</doc>


Desired Result:


<newDoc>
    <a />
    <b />
    <c />
    <d />
    <e />
</newDoc>


Anybody have a suggestion?



Thanks,


Nathan

============================================================
Nathan Potter                 Oregon State University, COAS
ndp at coas.oregonstate.edu   104 Ocean. Admin. Bldg.
541 737 2293 voice            Corvallis, OR   97331-5503
541 737 2064 fax

Current Thread