My XML looks like this
<page>
<orderhistory>
<order>
<ordernr>10610000000001</ordernr>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
</order>
<order>
<ordernr>10210000000001</ordernr>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
</order>
<order>
<ordernr>10110000000001</ordernr>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
</order>
<order>
<ordernr>10310000000001</ordernr>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
<orderrecord>
<productcategory>Forms</productcategory>
</orderrecord>
</order>
</orderhistory>
What i want is to show all productcategories that belongs to a single order. so if there are more orderrecords in one order I want to show all categories without duplicates next the ordernr.
But it looked like this
03-06-2009 10610000000001 something something
03-06-2009 10210000000001 something
03-06-2009 10110000000001 something
03-05-2009 10310000000001 Forms something
I made a XSL to group the productcategories from the orderrecords, so that duplicates are removed. It seemed to work fine, but the problem is that i want it to be grouped by order.
<xsl:key name="orderrecord-by-productcategory" match="orderrecord" use="productcategory" />
<xsl:template match="/page/orderhistory/order">
<xsl:for-each select="orderrecord[generate-id(.) =generate-id(key('artists-by-country', productcategory)[1])]" >
<xsl:value-of select="productcategory" />
</xsl:for-each>
</xsl:template>
My output looks like this now
03-06-2009 10610000000001 something
03-06-2009 10210000000001
03-06-2009 10110000000001
03-05-2009 10310000000001 Forms
but i want it to look like this.
03-06-2009 10610000000001 something
03-06-2009 10210000000001 something
03-06-2009 10110000000001 something
03-05-2009 10310000000001 Forms something
How can i do this?