Grouping in Tamino

How do I do grouping in tamino?

Finally I find out the way to do grouping. But now I have a different problem. Now I want to sum up one of the field. Following is my senario.

-
-
B7
1
hello world
232.89

-
B7
2
hello world
232.89

-
B1
2
Watermelon Blend
2.00

-
b78
1
4354
45.00

-
b78
1
4354
45.00

-
b78
7
4354
45.00

-
B3
1
Papaya Blend
1.50

-
B3
1
Papaya Blend
1.50

-
B5
10
Sousop Blend
2.00

-
B1
5
Watermelon Blend
1.50

-
b00
1
tete
1.00

-
b00
1
tete
1.00

-
b00
3
tete
1.00

-
b00
2
tete
1.00

-
b00
3
tete
1.00



I did the grouping in using the following code.
Defined the Key:
<xsl:key name=“itemdescrption” match=“itemdetail” use=“itemdes” />
<xsl:key name=“optionselect” match=“itemdetail” use=“concat(itemdes, ‘/’, @option)” />
For loop for retrival

<xsl:variable name=“itemdetail_items” select=“itemdetail[key(‘itemdescrption’, itemdes)]” />
- <xsl:for-each select=“$itemdetail_items[generate-id() = generate-id(key(‘optionselect’, concat(itemdes, ‘/’, @option))[1])]”>
<xsl:value-of select=“itemdes” />


<xsl:value-of select=“@option” />




- <xsl:for-each select=“key(‘optionselect’, concat(itemdes, ‘/’, @option))”>
<xsl:value-of select=“quantity” />


</xsl:for-each>


</xsl:for-each>

Now how do I sum up the quantity? Or is there a better way to do this?

This is an XSLT question, not really a Tamino question. Grouping and summing in XSLT have changed significantly from XSLT version 1 to version 2. In version 2 (only available in the Saxon XSLT processor), you can use the sum function http://www.w3.org/TR/xpath-functions/#func-sum
but in version 1 I don’t know how to do it.

Bill

I missed the fact that this question had not yet been answered. Are you still looking for an answer? As Bill says, it’s an XSLT question: perhaps you should start again and ask it in the XSLT forum. Or a good place for XSLT coding advice, if the question isn’t specific to Software AG products, is the xsl-list at www.mulberrytech.com.