selecting unique values within seperate node lists

Hello list,
I have the following XML document:
<?xml version="1.0" encoding="UTF-8"?>




monthToDate
100
HPQ Enterprise
Worldwide


monthToDate
200
Enterprise Systems Group
Worldwide


yearToDate
300
HPQ Enterprise
Worldwide


yearToDate
400
Enterprise Systems Group
Worldwide





This is the Order Nugget Portlet Status text


This is the Order Nugget Dynamic Message text


This is the Order Nugget User Submitted text




And I need to creat an HTML row from the elements, ie MonthToDate and YearToDate. The kicker is that MonthToDate and YearToData repeate between node sets–as you can see each occur twice–i just need them once to create a headin for an HTML table. Then I need to extract the product names along with the content. So the HTML would look like the following:
MonthToDate YearToDate
HPQ Enterprise 100 300
Enterprise
Systems Group 200 400
Worldwide

I have attached the stylesheet I have hacking around in. Many thanks
Shane
dataNuggetView2.xsl (3.07 KB)

This is a standard grouping problem. There are two standard coding patterns for solving grouping problems in XSLT. The first (simple but not very efficient) is to use a construct like

select="name[not(.=…/preceding-sibling::*/name)]"

which selects the name elements that don’t match the name in a previous record.

For large data sets, a much more efficient approach is the so-called Muenchian grouping method, which is described in most XSLT textbooks, and also at http://www.jenitennison.com/xslt/grouping

I hope this helps you.

Michael Kay

thanks for the info! the attached xsl seems to do the trick. you can apply it to the sample xml in my original post.
dataNuggetView3.xsl (2.87 KB)