Bonjour,
Suite à mon thread précédent, j'ai essayé d'appliquer la solution proposée par tsuji mais je n'arrive pas à l'étendre à des hiérarchisations complémentaires.
Voici donc un exemple plus complet de ce que je souhaite faire :
Transformer ce XML "plat" :
En :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <Employees> <Employee> <ID>1</ID> <WeekID>1</WeekID> <DayID>1</DayID> <Hours>5</Hours> </Employee> <Employee> <ID>1</ID> <WeekID>1</WeekID> <DayID>1</DayID> <Hours>4</Hours> </Employee> <Employee> <ID>1</ID> <WeekID>1</WeekID> <DayID>2</DayID> <Hours>7</Hours> </Employee> <Employee> <ID>1</ID> <WeekID>2</WeekID> <DayID>1</DayID> <Hours>5</Hours> </Employee> <Employee> <ID>1</ID> <WeekID>2</WeekID> <DayID>3</DayID> <Hours>8</Hours> </Employee> <Employee> <ID>2</ID> <WeekID>1</WeekID> <DayID>1</DayID> <Hours>5</Hours> </Employee> <Employee> <ID>2</ID> <WeekID>2</WeekID> <DayID>4</DayID> <Hours>4</Hours> </Employee> </Employees>
Quelle serait la transformation XSL à appliquer ? (petite précision qui a son importance : je ne peux pas appliquer le XSLT 2.0, il me faut trouver une solution en XSLT 1.0...)
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 <Employees> <Employee> <ID>1</ID> <Weeks> <Week> <WeekID>1</WeekID> <Days> <Day> <DayID>1</DayID> <Hours>5</Hours> <Hours>4</Hours> </Day> <Day> <DayID>2</DayID> <Hours>7</Hours> </Day> </Days> </Week> <Week> <WeekID>2</WeekID> <Days> <Day> <DayID>1</DayID> <Hours>5</Hours> </Day> <Day> <DayID>3</DayID> <Hours>8</Hours> </Day> </Days> </Week> </Weeks> </Employee> <Employee> <ID>2</ID> <Weeks> <Week> <WeekID>1</WeekID> <Days> <Day> <DayID>1</DayID> <Hours>5</Hours> </Day> </Days> </Week> <Week> <WeekID>2</WeekID> <Days> <Day> <DayID>4</DayID> <Hours>4</Hours> </Day> </Days> </Week> </Weeks> </Employee> </Employees>
Merci d'avance,
Flophie
Partager