Showing posts with label XSLT. Show all posts
Showing posts with label XSLT. Show all posts

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.

XTrans

I've been working with the program XTrans for creating XSL templates. XTrans is a free Windows program. It opens quickly and is very useful with a straightforward user-interface. The workflow is very developer-friendly. You open your XML and then create your XSL viewing them side-by-side, top-and-bottom, or one window at a time. No mouse is necessary when using the app (something I love). It has an XPath query analyzer so you can easily test your XPath queries. With the Normalize command, you can have XTrans indent your XML or XSL. By pressing the context menu key (or a right mouse click) you get a menu for inserting and XSL command/statement. I've been trying some other apps recently, but I keep coming back to this one.