Bonjour,
Débutant ici :)
Utilisant ce fichier XML,
http://pages.infinit.net/plague/top500.xml
Comment je peux faire un fichier XSLT qui va produire cette sortie:
Je demande pas nécessairement un fichier XSLT complet, juste quelques astuces pour me pointer dans la bonne direction, s'il vous plait. J'imagine que vous aller mentionner l'algorithme de Muench et xsl:key mais mes attemptives avec ça n'ont pas porté fruit.
J'ai encore un long bout à faire... voici mon fichier XSLT en progrès.
Merci! :)
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 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:top500="http://www.top500.org/xml/top500/1.0"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="sites-by-country" match="top500:site" use="top500:country"/> <xsl:template match="/top500:list"> <html> <head> <title>ALL COUNTRIES IN TOP 500</title> </head> <body> <table style="text-align:left"> <tr style="background-color=7777FF"> <th width="150">Countries</th> <th>Count</th> <th>Share %</th> </tr> <xsl:for-each select="top500:site/top500:country"> <xsl:sort select="top500:country"/> <tr> <td> <xsl:value-of select="."/> </td> <td> <xsl:value-of select="count(//top500:site[top500:country=current()])"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Partager