[XSL] Trier dans un ordre déterminé
Bonjour (encore moi)
Voici mon XML:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<CL Change="24380">
<Comment>
<Category Title="compilfix"></Category>
<Product Title="prod1"></Product>
<Desc> missing file</Desc>
</Comment>
</CL>
<CL Change="24378">
<Comment>
<Category Title="bugfix"></Category>
<Product Title="prod2"></Product>
<Desc>desc new</Desc>
</Comment>
<Comment>
<Category Title="bugfix"></Category>
<Product Title="prod1"></Product>
<Desc>another desc</Desc>
</Comment>
</CL> |
et le XSL appliqué dessus:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
<xsl:template match="Version">
<xsl:for-each select="//CL/Comment/Category[generate-id(.)=generate-id(key('cat',@Title))]">
<xsl:variable name="currentCat" select="@Title"/>
<xsl:value-of select="@Title"/>
<xsl:for-each select="//CL/Comment/Product[generate-id(.)=generate-id(key('prod',@Title)[preceding-sibling::Category/@Title=$currentCat])]">
<xsl:variable name="currentProd" select="@Title"/>
<xsl:value-of select="$currentProd"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
|
Actuellement, l'affichage se fera en fonction de l'ordre dans le XML (dans le cas ci-dessus, j'arai d'abord la Category 'compilfix', puis 'bugfix'.
Y'a t il un moyen pour choisir l'ordre dans lequel ce sera affiché ? (sachant que l'ordre dans le xml est totalement aléatoire et que le xml contiendra plusieurs Category differentes)
Merci d'avance pour le coup de main
K.