Monday, July 7, 2008

Simulating SQL "DISTINCT" in XSLT

If you have a list of elements from which you only want one occurance of each unique value, in SQL you would just add "DISTINCT" infront of the column. You can do something in XSLT which gives you the same functionality. Take a look at this example:
//Product[Hight][not(Hight=preceding-sibling::Product/Hight)]
This example will do just that with Product elements with a subnode called Hight. So only one occurance of each Hight!

No comments: