Alors voilà j'affiche sous forme de TreeView mon fichier XML dont le schéma est :
on a 1500 personnes environ
<PERSONNE>
<NOM/>
<SERVICE/>
<ENTITE/>
...
</PERSONNE>
alors je prends dans un premier temps le fichier XML non trié, et je le trie (ca ca fonctionne bien) je récupère donc un fichier xml trié dans le bon ordre :
1) Par entité
2) Par Service
3) Par nom
maintenant je veux voir un treeview de la forme
- Entite
- Service
- Nom
et bien sur pouvoir faire un tri croissant et décroissant, mais le pb c'est que l'affichage est tout le temps dans le même ordre malgré le tri précédent. voilà la feuille XSLT :
Si au passage vous trouvez que ma feuille de style n'est pas top, je suis preneur de vos remarques.
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 <?xml version='1.0' encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent = "yes"/> <xsl:template match="REPERTOIRE"> <!--<UL>--> <table border="0" id="Tableau1" width="98%" align="right" cellpadding="0" cellspacing="0"> <!-- ON PARCOURT LES ENTITES --> <xsl:for-each select="PERSONNE[not(ENTITE=preceding-sibling::PERSONNE/ENTITE)]/ENTITE"> <xsl:sort/> <xsl:variable name="currentEntite"> <xsl:value-of select="."/> </xsl:variable> <tr> <td> <br/> <a onclick="javascript:toggle(this)" > <img src="include/Images/Plus.gif"/> <b id="search"><xsl:value-of select="$currentEntite"/></b> </a> <div style="display: none"> <table width="100%" cellpadding="0" cellspacing="0"> <!-- ON PARCOURT LES SERVICES DE CETTE ENTITE --> <xsl:for-each select="../../PERSONNE[ENTITE=$currentEntite and not(SERVICE=preceding-sibling::PERSONNE[1]/SERVICE)]/SERVICE"> <xsl:sort/> <xsl:variable name="currentService"> <xsl:value-of select="."/> </xsl:variable> <tr> <td width="15"/> <!-- permet de décaller... --> <td> <br/> <a onclick="javascript:toggle(this)" > <img src="include/Images/Plus.gif"/> <b id="search"><font size="2" color="#A29DF9"><xsl:value-of select="$currentService"/></font></b> </a> <div style="display: none"> <table width="100%" cellpadding="0" cellspacing="0"> <!-- ON PARCOURT LES PERSONNES DE CE SERVICE --> <xsl:for-each select="../../PERSONNE[SERVICE=$currentService and ENTITE=$currentEntite]"> <xsl:sort select="NOM"/> <tr id="{NOM}" onMouseOver="this.bgColor='#ADC8E9';" onMouseOut="this.bgColor='#F5F5F5';"> <xsl:attribute name="ondblclick"> <xsl:text disable-output-escaping="yes">popup("http://parinf02/annuaire/testXml.asp?Id=</xsl:text><xsl:value-of select="ID" /><xsl:text disable-output-escaping="yes">")</xsl:text> </xsl:attribute> <td width="14%"><b><xsl:value-of select="NOM"/></b></td> <td width="14%"><xsl:value-of select="PRENOM"/></td> <td width="11%"><xsl:value-of select="TELEPHONE"/></td> <td width="11%"><xsl:value-of select="PORTABLE"/></td> <td width="11%"><xsl:value-of select="FAX"/></td> <td width="24%"><xsl:value-of select="SERVICE"/></td> <td width="15%"><xsl:value-of select="LOCALISATION"/></td> </tr> </xsl:for-each> </table> </div> </td> </tr> </xsl:for-each> </table> </div> </td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>
Partager