Bonjour à tous,
dans le cadre d'un petit projet je dois réaliser une feuille de transformation XSLT qui présente des ouvrages dans leur ordre de parution
Voici une partie du fichier xml :
Code XML : 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 <pulp-series-plus> <hero>&ds;</hero> <house-name by="robeson"/> <series> <item by="dent"> <title><skippable>The </skippable>Annihilist</title> <pulp name="&dsm;" nb="22" year="1934" month="dec"/> <pocket-book publisher="Bantam" nb="31" year="1968" month="dec"/> <abstract> <par> The dread Annihilist was slaughtering the criminals of New York in wholesale lots. Hundreds of men were found mysteriously murdered, victims of the hideous pop-eyed death. The finger of suspicion pointed directly at one man, &ds; himself. Even as the &bzm; scrambled to solve the terrifying enigma, the invisible assassin began to play havoc with one of the humanity's most important secret defenses&em-dash;&ds;'s legendary crime college. </par> </abstract> <translation xml:lang="de" by="heinz" publisher="Pabel" nb="24" year="1974" month="oct"> <title><skippable>Der </skippable>Superkiller</title> </translation> <translation xml:lang="fr" by="olivier" publisher="Marabout" nb="26" year="1972"> <title><skippable>Le </skippable>destructeur</title> </translation> </item> <item by="dent"> <title><skippable>The </skippable>Awful Egg</title> <pulp name="&dsm;" nb="88" month="jun" year="1940"/> <pocket-book publisher="Bantam" nb="92" month="oct" year="1978"/> <abstract> <par> From the frozen heart of the American continent comes a nameless prehistoric terror of unspeakable savagery, leaving a broken trail of mangled victims that shocks and baffles the world. Only the superman &bzm; can meet this horrifying menace on its own bloody ground&em-dash;and uncover the even greater evil that spawned it. </par> </abstract> <translation xml:lang="de" by="kurtz" publisher="Pabel" nb="83" year="1979" month="apr"> <title><skippable>Das </skippable>Höhlenmonster</title> </translation> </item> <item by="dent"> <title><skippable>The </skippable>Boss of Terror</title> <pulp name="&dsm;" nb="87" year="1940" month="may"/> <pocket-book publisher="Bantam" nb="85" year="1976" month="nov"/> <abstract> <par> Men by the name of Smith were being knocked off all over town. And they were all killed by lightning&em-dash;lightning that entered a room without leaving any marks, on a day when there was no lightning. As the &bzm; penetrated ever closer to the heart of this mystery, he was scared. For he knew he was closer to death that possibly at any other time in his hair-raising career. </par> </abstract> <translation xml:lang="de" by="kurtz" publisher="Pabel" nb="63" year="1977" month="oct"> <title><skippable>Der </skippable>Boss des Schrekens</title> </translation> </item> </series> </pulp-series-plus>
Toutefois, je ne parviens pas à afficher les résultats en triant sur les mois (jan, feb etc) en plus de l'année.
Voici mon xslt qui m'affiche les ouvrages par année de parutaion :
Code XSL : 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 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="2.0" id="lpro-savage" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsd"> <xsd:month name="jan" order="01"/> <xsd:month name="feb" order="02"/> <xsd:month name="mar" order="03"/> <xsd:month name="apr" order="04"/> <xsd:month name="may" order="05"/> <xsd:month name="jun" order="06"/> <xsd:month name="jul" order="07"/> <xsd:month name="aug" order="08"/> <xsd:month name="sep" order="09"/> <xsd:month name="oct" order="10"/> <xsd:month name="nov" order="11"/> <xsd:month name="dec" order="12"/> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:variable name="eol" select="' '"/> <xsl:template match="pulp-series-plus"> <xsl:apply-templates select="series"/> </xsl:template> <xsl:template match="series"> <xsl:apply-templates select="item[pulp]"> <xsl:sort select="pulp/@year" data-type="number" order="ascending"/> </xsl:apply-templates> </xsl:template> <xsl:template match="item"> <xsl:apply-templates select="pulp"/> <xsl:if test="not(pulp[title])"> <xsl:apply-templates select="title"/> </xsl:if> <xsl:value-of select="$eol"/> </xsl:template> <xsl:template match="pulp"> <xsl:value-of select="$eol"/> <xsl:value-of select="@nb,$eol"/> <xsl:value-of select="@name,$eol"/> <xsl:value-of select="@year,@month,$eol"/> <xsl:value-of select="title"/> </xsl:template> <xsl:template match="title"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>
J'aurais besoin d'un petit coup de pouce pour y parvenir.
Je vous remercie.
Partager