Bonjour, je ne comprend pas comment utiliser la balise sort pour trier par colonne un fichier xml afficher en tableau.
Version imprimable
Bonjour, je ne comprend pas comment utiliser la balise sort pour trier par colonne un fichier xml afficher en tableau.
Salut,
Tu as une explication général ici: http://www.w3schools.com/xsl/el_sort.asp
Si sa suffit pas demande plus d'info sur le point qui te pose problème!
++
Thierry
Le problmee en question, j'ai; lui ce tutoriel interesant( enfin, cette page), j'ai ensuite restructuré un minimum mon fichier XSL et aprésent un problême se pose :
Vers la ligne 25, dans apply-template, que dois je mettre a l'attribut select, et a celui de la balise sort(non ca c'est de mon choix).Code:
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 <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <title>Liste des divinitées et autres dans la mythologie grecque.</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" media="screen" type="text/css" title="Design du tableau" href="design.css" /> </head> <body> <table border="1" cellspacing="0" cellpadding="3"> <tr> <th colspan="7">Liste des divinitées et autres dans la mythologie grecque.</th> </tr> <tr> <th>Nom</th> <th>Type</th> <th>Domaine</th> <th>Signification</th> <th>Pere</th> <th>Mere</th> <th>Etoile</th> </tr> <xsl:apply-templates select="*"> <xsl:sort select="nom"/> </xsl:apply-templates> </table> </body> </html> </xsl:template> <xsl:template match="*"> <xsl:apply-templates /> </xsl:template> <xsl:template match="personne"> <tr> <td> <xsl:value-of select="nom"/> </td> <td> <xsl:choose> <xsl:when test="type = 'Type'"> <b><xsl:value-of select="type"/></b> </xsl:when> <xsl:when test="type = 'Sous-type'"> <b><xsl:value-of select="type"/></b> </xsl:when> <xsl:otherwise> <xsl:value-of select="type"/> </xsl:otherwise> </xsl:choose> </td> <td> <xsl:value-of select="domaine"/> </td> <td><em> <xsl:value-of select="signification"/> </em></td> <td> <xsl:value-of select="pere"/> </td> <td> <xsl:value-of select="mere"/> </td> <td> <xsl:value-of select="etoile"/> </td> </tr> </xsl:template> </xsl:stylesheet>
[EDIT :PS] Excusez moi pour le scroller [/EDIT]
Désolé je ne comprend pas ce que tu essaye de me dire...
Si tu ne sais pas bien le français reformule avec d'autres mots.
Si tu le sais applique toi un peu!
Merci
Dans la balise <xsl:apply-template s> j ne sais pas quel valeur donner a select
essaye avec select="node()" ou select="." .
Soit, ca ne trie pas du tout soit : "XSLT processing failed!"
J'ai essayé avec "*" avec "/" avec le nom de ma balise racine...Je ne vois p