Re: [xsl] "SQL distinct" like applying of templates

Subject: Re: [xsl] "SQL distinct" like applying of templates
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Wed, 03 Nov 2004 06:52:25 -0700
news@xxxxxxxxxxx wrote:

Sounds like a perfect time to visit JeniTennison.com and learn about grouping using a variety of methods, the one in particular that you will need to focus on involves using the key element and key function coupled with the generate-id() function to compare the nodes of a resulting node-set() to see if they are the first in the resulting list of elements with the same value....

I would start at the beginning of her site though and spend a good hour or two getting a feel for how things are layed out and for her style of teaching. Jeni is one of the most thorough teachers you will ever encounter and stands right next to Dr. Michael Kay, David Carlisle, et. Al. as far as her understanding and expertise of both the language and the technique involved in creating well thought through (and therefore extremely robust) solutions that perform the desired task in the most efficient manner possible.

If you still have questions after running through her grouping tutorials then I can assure you that any of the members of this list with the proper knowledge will be more than happy to help you further... again, the site is http://www.jenitennison.com/ .. click on "Jeni's XSLT Pages" and look through the directory for "Grouping" related tutorials... the time you spend there now will return to you a hundred fold in future XSLT development as you will have more than an understanding of how to do the grouping of distinct elements as Jeni will help you understand the foundation of the prescribed solution and as such help you understand other areas to apply this knowledge as well.

Another GREAT site is Dave Pawsons XSLT FAQ... a well organized and code heavy site in which he has been indexing the solutions developed by members of this list since its inception over 5 years ago... you can find the FAQ from the main entry point at http://dpawson.co.uk/

And I will not have done my duty as a student of the master if I dont mention Dr. Kays developers reference... if you dont already have a copy visit http://www.amazon.com/exec/obidos/ASIN/0764543814/qid=1099489823/sr=2-3/ref=pd_ka_b_2_3/104-2547459-4054318 and pick up a copy of XSLT 2nd Edition to start... XSLT 2.0 (the third edition of his XSLT titles) is out now but it seems you are in need of XSLT 1.0 info and this first one is the correct title for 1.0 based transformations.

Best of luck to you!

<M:D/>


I have a list, with many elements having equal names. The values of the items are strings. I want to select each different string exactly one time. Just like in SQL while using the "distinct" option.

Example:
<list>
	<item>string1</item>
	<item>string2</item>
	<item>string2</item>
	<item>string3</item>
</list>

I want to get the following list, omitting the second node with the value
"String2".
string1
string2
string3


Is this possible woth XSLT, and how?


thanks a lot!

jan

Current Thread