Bonjour,

Je viens de découvrir le XSL 2.0 qui semble bien plus puissant que le 1.0.

J'essaye de faire un group-by sur de multiple valeur mais je ne sais pas du tout comment m'y prendre

Exemple

XML Entrant
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<root>
	<commande article_id="1" client_id="1" date_achat="01/01/2009"/>
	<commande article_id="1" client_id="1" date_achat="25/01/2009"/>
	<commande article_id="3" client_id="2" date_achat="01/01/2009"/>
	<commande article_id="1" client_id="1" date_achat="01/01/2009"/>
	<commande article_id="2" client_id="2" date_achat="09/01/2009"/>
	<commande article_id="4" client_id="2" date_achat="05/01/2009"/>
	<commande article_id="5" client_id="1" date_achat="01/01/2009"/>
	<commande article_id="3" client_id="2" date_achat="12/01/2009"/>
	<commande article_id="2" client_id="1" date_achat="12/01/2009"/>
	<commande article_id="6" client_id="1" date_achat="06/01/2009"/>
</root>

XML SORTANT
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
<groups>
	<group article_id="1" client_id="1">
		<commande article_id="1" client_id="1" date_achat="01/01/2009"/>		
		<commande article_id="1" client_id="1" date_achat="25/01/2009"/>
		<commande article_id="1" client_id="1" date_achat="01/01/2009"/>
	</group>
	<group article_id="3" client_id="2">
		<commande article_id="3" client_id="2" date_achat="01/01/2009"/>
		<commande article_id="3" client_id="2" date_achat="12/01/2009"/>
	</group>
	<group article_id="2" client_id="2">
		<commande article_id="2" client_id="2" date_achat="09/01/2009"/>
	</group>
	<group article_id="4" client_id="2">
		<commande article_id="4" client_id="2" date_achat="05/01/2009"/>
	</group>
	<group article_id="5" client_id="1">
		<commande article_id="5" client_id="1" date_achat="01/01/2009"/>
	</group>
	<group article_id="2" client_id="1">
		<commande article_id="2" client_id="1" date_achat="12/01/2009"/>
	</group>
	<group article_id="6" client_id="1">
		<commande article_id="6" client_id="1" date_achat="06/01/2009"/>
	</group>
</groups>
J'aimerai donc faire un group-by sur article_id et client_id.

Pour l'instant, mon XSL ressemble à ça :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
	<xsl:output  method="xml" indent="yes" omit-xml-declaration="yes"/>
 
<xsl:template  match="/root">
	<xsl:for-each-group  select="commande" group-by="@article_id, @client_id">
		<node article="{@article_id}" client="{@client_id}">
			<xsl:apply-templates  select="current-group()"/>
		</node>
	</xsl:for-each-group>
</xsl:template>
<xsl:template match="commande">
	<date><xsl:value-of select="@date_achat"/></date>
</xsl:template>
</xsl:stylesheet>
Une idée de comment je dois m'y prendre ?