Sunday, September 24, 2006

Select distinct in XSLT

Hard to believe, but there is no equivalent in XSLT to the SELECT DISTINCT SQL command. After doing some research, I came across a technique for getting distinct data called the "Muenchian Technique". Here is an example I made based on this method.

First the XML:


Then the XSL:



The result:


I threw the weight in to show that you are getting the first Clumber. Leaving that out would result in a list of all the distinct breeds in the dogs.xml file.

Another cool find was this site describing the key function in XSLT.