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.

2 comments:

  1. This post was very helpful for my work, thanks

    ReplyDelete
  2. That's great to hear! Thanks for letting me know.

    ReplyDelete