bonjour, je débute avec xslt et 2 questions me viens. Afin de bien situer mes questions, je vous montre le fichier XML à parser et le fichier XSLT que j'ai créé puis les questions.
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 1 <?xml version="1.0" encoding="UTF-8"?> 2 <root> 3 <namespace identity=""> 4 <usage></usage> 5 6 <class identity=""> 7 <visibility><visibility> 8 9 <declaration></declaration> 10 11 <heritance></heritance> 12 13 <class_attribute identity=""> 14 <visibility></visibility> 15 <declaration></declaration> 16 <value></value> 17 </class_attribute> 18 19 <intance_attribute identity=""> 20 <visibility></visibility> 21 <declaration></declaration> 22 <value></value> 23 </instance_attribute> 24 25 <property identity=""> 26 <visibility></visibility> 27 <get></get> 28 <constructor></construcor> 29 </property> 30 31 <signal identity=""> 32 <visibility><visibility> 33 <declaration></declaration> 34 </signal> 35 36 <methode identity=""> 37 <visibility></visibility> 38 <declaration></declaration> 39 <parameter></parameter> 40 <base> 41 <parameter></parameter> 42 </base> 43 <code></code> 44 </methode> 45 </class> 46 47 <interfaces> 48 <visibility><visibility> 49 50 <declaration></declaration> 51 52 <heritance></heritance> 53 54 <class_attribute identity=""> 55 <visibility></visibility> 56 <declaration></declaration> 57 <value></value> 58 </class_attribute> 59 60 <intance_attribute identity=""> 61 <visibility></visibility> 62 <declaration></declaration> 63 <value></value> 64 </instance_attribute> 65 66 <property identity=""> 67 <visibility></visibility> 68 <get></get> 69 <constructor></construcor> 70 </property> 71 72 <signal identity=""> 73 <visibility><visibility> 74 <declaration></declaration> 75 </signal> 76 77 <methode identity=""> 78 <visibility></visibility> 79 <declaration></declaration> 80 <parameter></parameter> 81 <base> 82 <parameter></parameter> 83 </base> 84 <code></code> 85 </methode> 86 </interfaces> 87 88 </namespace> 89 </root>je souhaiterais savoir :
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 1 <?xml version="1.0" encoding="UTF-8"?> 2 <xsl:stylesheet id="style_txt" 3 version="1.5" 4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 5 xmlns:fo="http://www.w3.org/1999/XSL/Format"> 6 7 <xsl:output 8 method="txt" 9 encoding="UTF-8" 10 doctype-system="http://www.w3.org/TR/html4/strict.dtd" 11 indent="yes" /> 12 13 <xsl:template match="namespace"> 14 15 /** 16 * ++ Namespace ++ <xsl:value-of select="@identity" /> 17 */ 18 namespace <xsl:value-of select="@identity" /> 19 20 <xsl:apply-templates select="class" /> 21 22 </xsl:template> 23 24 <xsl:template match="class"> 25 /** 26 * __Requirement:__ 27 */ 28 <xsl:apply-templates select="usage" /> 29 30 /** 31 * Oject: <xsl:value-of select="@identity"> 32 */ 33 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity"> : <xsl:apply-templates select="heritance"> 34 { 35 <xsl:apply-templates select="class_attribute"> 36 <xsl:apply-templates select="intance_attribute"> 37 <xsl:apply-templates select="property"> 38 <xsl:apply-templates select="signal"> 39 <xsl:apply-templates select="methode"> 40 } 41 </xsl:template> 42 43 <xsl:template match="interfaces"> 44 /** 45 * Interface: <xsl:value-of select="@identity"> 46 */ 47 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity"> : <xsl:apply-templates select="heritance"> 48 { 49 <xsl:apply-templates select="class_attribute"> 50 <xsl:apply-templates select="intance_attribute"> 51 <xsl:apply-templates select="property"> 52 <xsl:apply-templates select="signal"> 53 <xsl:apply-templates select="methode"> 54 } 55 </xsl:template> 56 57 <xsl:template match="usage"> 58 /** 59 * * <xsl:value-of select="."> 60 */ 61 usage <xsl:value-of select=".">; 62 </xsl:template> 63 64 <xsl:template match="class_attribute"> 65 /** 66 * Class Attribute: <xsl:value-of select="@identity"> 67 */ 68 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity">; 69 </xsl:template> 70 71 <xsl:template match="instance_attribute"> 72 /** 73 * Instance Attribute: <xsl:value-of select="@identity"> 74 */ 75 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity">; 76 </xsl:template> 77 78 <xsl:template match="property"> 79 /** 80 * Property: <xsl:value-of select="@identity"> 81 */ 82 <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity"> 83 { 84 <xsl:apply-templates select="get"> 85 <xsl:apply-templates select="constructor"> 86 } 87 </xsl:template> 88 89 <xsl:template match="signal"> 90 /** 91 * Signal: <xsl:value-of select="@identity"> 92 */ 93 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity">(); 94 </xsl:template> 95 96 <xsl:template match="methode"> 97 /** 98 * Methode: <xsl:value-of select="@identity"> 99 * Parameter: <xsl:apply-templates select="parameter"> 100 * Base : 101 */ 102 <xsl:apply-templates select="visibility"> <xsl:apply-templates select="declaration"> <xsl:value-of select="@identity">( <xsl:apply-templates select="parameter"> ) <xsl:apply-templates select="base"> 103 { 104 <xsl:apply-templates select="code"> 105 } 106 </xsl:template> 107 108 <xsl:template match="visibility"> 109 <xsl:value-of select="."> 110 </xsl:template> 111 112 <xsl:template match="declaration"> 113 <xsl:value-of select="."> 114 </xsl:template> 115 116 <xsl:template match="heritance"> 117 <xsl:value-of select="."> 118 </xsl:template> 119 120 <xsl:template match="value"> 121 <xsl:value-of select="."> 122 </xsl:template> 123 124 <xsl:template match="get"> 125 get { <xsl:value-of select="."> } 126 </xsl:template> 127 128 <xsl:template match="constructor"> 129 construct { <xsl:value-of select="."> } 130 </xsl:template> 131 132 <xsl:template match="parameter"> 133 <xsl:value-of select="."> 134 </xsl:template> 135 136 <xsl:template match="base"> 137 base : ( <xsl:apply-templates select="parameter"> ) 138 </xsl:template> 139 140 <xsl:template match="code"> 141 <xsl:value-of select="."> 142 </xsl:template> 143 144 </xsl:stylesheet>
Comment à la ligne 100 de mon fichier XSLT récupérer le contenu entre les balise <base></base> du noeud fille?
et pour la ligne 102 comment ajouter des parametres avec une virgule sauf pour le dernier élément?
Je vous remercie de m'avoir lu.
Je vous souhaite une bonne soirée![]()








Répondre avec citation





Partager