Hello everybody

J'ai un peu de mal avec un select distinct + tri sur un xpath.
Voilà mon xml :

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0" encoding="windows-1250"?>
<NewDataSet>
  <SESSION>
    <seance_date_deb>dimanche 25 novembre 2012 16:00</seance_date_deb>
    <ZONE>
      <FLOOR>
        <SECTION>
          <CATEGORY>
            <categorie_id>820004</categorie_id>
            <categ_nom>SERIE D</categ_nom>
            <PRICELIST>
              <type_tarif_id>240164</type_tarif_id>
              <type_tarif_nom>PASS FIDELITE WEB</type_tarif_nom>
              <categ_id>820004</categ_id>
              <montant>1710</montant>
            </PRICELIST>
            <PRICELIST>
              <type_tarif_id>240163</type_tarif_id>
              <type_tarif_nom>PASS JEUNE WEB</type_tarif_nom>
              <categ_id>820004</categ_id>
              <montant>1000</montant>
            </PRICELIST>
            <PRICELIST>
              <type_tarif_id>240047</type_tarif_id>
              <type_tarif_nom>PLEIN TARIF WEB</type_tarif_nom>
              <categ_id>820004</categ_id>
              <montant>1900</montant>
            </PRICELIST>
          </CATEGORY>
        </SECTION>
      </FLOOR>
      <FLOOR>
        <SECTION>
          <CATEGORY>
            <categorie_id>820005</categorie_id>
            <categ_nom>SERIE E</categ_nom>
            <PRICELIST>
              <type_tarif_id>240164</type_tarif_id>
              <type_tarif_nom>PASS FIDELITE WEB</type_tarif_nom>
              <categ_id>820005</categ_id>
              <montant>900</montant>
            </PRICELIST>
          </CATEGORY>
        </SECTION>
      </FLOOR>
      <FLOOR>
        <SECTION>
          <CATEGORY>
            <categorie_id>820004</categorie_id>
            <categ_nom>SERIE D</categ_nom>
            <PRICELIST>
              <type_tarif_id>240047</type_tarif_id>
              <type_tarif_nom>PLEIN TARIF WEB</type_tarif_nom>
              <categ_id>820004</categ_id>
              <montant>1900</montant>
            </PRICELIST>
          </CATEGORY>
          <CATEGORY>
            <categorie_id>820005</categorie_id>
            <categ_nom>SERIE E</categ_nom>
            <PRICELIST>
              <type_tarif_id>240164</type_tarif_id>
              <type_tarif_nom>PASS FIDELITE WEB</type_tarif_nom>
              <categ_id>820005</categ_id>
              <montant>900</montant>
            </PRICELIST>
            <PRICELIST>
              <type_tarif_id>240047</type_tarif_id>
              <type_tarif_nom>PLEIN TARIF WEB</type_tarif_nom>
              <zone_id>820001</zone_id>
              <etage_id>820007</etage_id>
              <section_id>820001</section_id>
              <categ_id>820005</categ_id>
              <montant>1000</montant>
              <frais>0</frais>
              <prise_place>0</prise_place>
              <vts_v>1</vts_v>
              <seance_id>3530</seance_id>
            </PRICELIST>
          </CATEGORY>
        </SECTION>
      </FLOOR>
      <FLOOR>
        <SECTION>
          <CATEGORY>
            <categorie_id>820001</categorie_id>
            <categ_nom>SERIE A</categ_nom>
            <PRICELIST>
              <type_tarif_id>240164</type_tarif_id>
              <type_tarif_nom>PASS FIDELITE WEB</type_tarif_nom>
              <montant>4500</montant>
            </PRICELIST>
            <PRICELIST>
              <type_tarif_id>240163</type_tarif_id>
              <type_tarif_nom>PASS JEUNE WEB</type_tarif_nom>
              <montant>2500</montant>
            </PRICELIST>
          </CATEGORY>
          <CATEGORY>
            <categorie_id>820004</categorie_id>
            <categ_nom>SERIE D</categ_nom>
            <PRICELIST>
              <type_tarif_id>240164</type_tarif_id>
              <type_tarif_nom>PASS FIDELITE WEB</type_tarif_nom>
              <categ_id>820004</categ_id>
              <montant>1710</montant>
            </PRICELIST>           
          </CATEGORY>
        </SECTION>
      </FLOOR>
    </ZONE>
  </SESSION>
</NewDataSet>
Le but du jeu est de faire une grille de tarif, avec en ligne les categories, en colonne les tarifs. J'ai reussi à faire :
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<table>
<tbody><tr class="GrilleTarifDateSeance"><th colspan="4" class="thGrilleTarifdate">dimanche 30 décembre 2012 16:00</th></tr>
<tr class="Categories">
<td></td>
<td>SERIE A</td>
<td>SERIE B</td>
<td>SERIE C</td>
<td>SERIE D</td>
<td>SERIE E</td>
</tr>
<tr>
<td>PASS FIDELITE WEB</td>
<td>45 eur
				</td>
<td>35.1 eur
				</td>
<td>26.1 eur
				</td>
<td>17.1 eur
				</td>
<td>9 eur
				</td>
</tr>
<tr>
<td>PASS JEUNE WEB</td>
<td>25 eur
				</td>
<td>19.5 eur
				</td>
<td>10 eur
				</td>
<td>10 eur
				</td>
<td>10 eur
				</td>
</tr>
<tr>
<td>PLEIN TARIF WEB</td>
<td>50 eur
				</td>
<td>39 eur
				</td>
<td>29 eur
				</td>
<td>19 eur
				</td>
<td>10 eur
				</td>
</tr>
<tr class="GrilleTarifEtageNom"><td></td></tr>
</table>
--> j'arrive à selectionner les distincts categs et tarifs pour faire mon tableau mais je voudrais, aussi, trier par nom de categ, et par nom de tarif.


J'ai tenté plusieurs trucs, un coup j'ai les categs triées mais pas uniques, un coups uniques mais pas triées.
mon xslt (avec 3 tests = tentatives d'apaptations à partir de

http://www.dpawson.co.uk/xsl/sect2/N6461.html#d9253e19
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
<xsl:variable name="unique-list" select="//categorie_id[not(.=following::categorie_id)]" />
<xsl:variable name="unique-listPrice" select="//type_tarif_id[not(.=following::type_tarif_id)]" order='descending' />
 
    <xsl:key name="categId" match="/NewDataSet/SESSION/ZONE/FLOOR/SECTION/CATEGORY/categorie_id" use="."/>
<xsl:key name="categsIdkey" match="//CATEGORY" use="categorie_id"/>
 
	<xsl:template match="/">
  <html>
  <body>
    <table >
      <xsl:for-each select="NewDataSet/SESSION">
	          <tr class="GrilleTarifDateSeance">
				<td colspan="1" >
					<xsl:value-of select="seance_date_deb"/>
				</td>
			</tr>
 
<xsl:variable name="nodeSession" select="."/> 
 
 
		<tr class="Categories">
		<td>Test avec unique-list</td>
		<xsl:for-each select="$unique-list">
 
			<xsl:variable name="vPos" select="."/>	
				<td><!-- nom categ -->
				yyy
				<xsl:value-of select="$nodeSession/ZONE/FLOOR/SECTION/CATEGORY[categorie_id=$vPos]/categ_nom"/>			
 
				</td>
		</xsl:for-each>
		</tr>
 
 
<tr>
<td>
Test avec categsIdkey :
<xsl:for-each
         select="//CATEGORY[generate-id(.)=
                        generate-id(key('categsIdkey',categorie_id)[1])]">
     <xsl:value-of select="categorie_id"/>     <!--show the grouping-->
     <xsl:text>
</xsl:text>
                         <!--select only those for the grouping-->
     <xsl:for-each select="//CATEGORY[categorie_id=current()/categorie_id]/categ_nom">
       <xsl:sort select="/categorie_id"/>    <!--sorted within grouping-->
       <xsl:text>  ddd </xsl:text>
       <xsl:value-of select="categorie_id"/>   <!--member distinctions-->
       <xsl:text>
</xsl:text>
     </xsl:for-each>
   </xsl:for-each>
</td>
</tr>
 
<tr>
<td>
Test avec key categId :
			   <xsl:for-each select="$nodeSession/ZONE/FLOOR/SECTION/CATEGORY/categorie_id[generate-id(.)=generate-id(key('categId',.)[1])]">
 
 
      <xsl:sort select="." order='descending'/> <!--Only if wanted 'sorted' -->
      <Unique-Item-List Element-Name="{.}">   
                          <!--Optional inner wrapper -->
	<xsl:for-each select="key('categId',.)/..">
                          <!-- Unique items -->
<xsl:value-of select="categ_nom"/><br/>
  <xsl:comment>Present any associated data. Context is Element-name
</xsl:comment>
 
        </xsl:for-each>
 
</Unique-Item-List> <!--Close inner wrapper -->
 
  </xsl:for-each>
</td>
</tr>
 
</xsl:for-each>
</table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
et du coup, je galere pas mal, il doit y avoir un truc à changer mais je ne vois pas quoi exactement.