This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: select distinct
- From: Trevor Nash <tcn at melvaig dot co dot uk>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 18 Sep 2002 16:18:56 +0100
- Subject: Re: [xsl] select distinct
- Organization: Melvaig Software Engineering Limited
- References: <006c01c25d98$273d5be0$0201a8c0@spearreport.local>
- Reply-to: xsl-list at lists dot mulberrytech dot com
On Mon, 16 Sep 2002 11:45:53 -0400, Noel Golding wrote:
>I have an xml file
>
>...
> <para>Some more text goes here <ref name="a1" />. some more text</para>
> </section>
> <section>
> <para>More text <ref name="a2" /> <ref name="a1" /></para>
> </section>
></document>
>
>I would like to get all the unique <ref /> elements.
>
><ref name="a1" />
><ref name="a2" />
>
>I am not sure what my xsl should look like to accomplish this.
>
That is essentially a grouping problem, which you will find explored
in great depth in the FAQ. The idea is to use xsl:key and the key()
function to get hold of all the ref elements with the same name, and
process only the first one: known as Meunchian grouping.
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771 271
email: tcn@melvaig.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list