programmation.xsl 10.3 KB
Newer Older
Neveux Anais's avatar
Neveux Anais committed
1
<?xml version="1.0" encoding="UTF-8"?>
2
3
<xsl:stylesheet xmlns="http://www.utc.fr/ics/hdoc/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Neveux Anais's avatar
Neveux Anais committed
4
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
6
7
8
9
10
11
12
13
14
15
16
17
    exclude-result-prefixes="xs"
    version="2.0"
    xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
    xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
    xmlns:cp="canope.fr:canoprof">
    <xsl:output method="xhtml"/>
    <xsl:strip-space elements="*" /> 
    <!-- Il faut uniformiser les sc:para -->
    <xsl:template match="sc:item">
        <xsl:apply-templates/>
    </xsl:template>
    <!--<xsl:template match="*"></xsl:template>-->
    <xsl:template match="cp:program">
Neveux Anais's avatar
Neveux Anais committed
18
        <xsl:processing-instruction name="oxygen">
19
         RNGSchema="../../schemas/xhtml/hdoc1-xhtml.rng" type="xml"</xsl:processing-instruction>
20
        <html>
Neveux Anais's avatar
Neveux Anais committed
21
            <head>
22
                <title><xsl:value-of select="cp:programM/sp:title"/></title>
Neveux Anais's avatar
Neveux Anais committed
23
24
                <meta charset="utf-8"/>
                <meta content="HdocConverter/Opale3.4" name="generator"/>
25
                <xsl:apply-templates select="cp:programM/child::*[name() != 'sp:abstract' and name()!= 'sp:title']"/>
Neveux Anais's avatar
Neveux Anais committed
26
27
            </head>
            <body>
28
29
                <xsl:apply-templates select="cp:programM/sp:abstract"/>
                <xsl:apply-templates select="child::*[name() != 'cp:programM']"/>
Neveux Anais's avatar
Neveux Anais committed
30
31
32
            </body>
        </html>
    </xsl:template>
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    <xsl:template match="sp:class">
        <meta name="description" content="{.}" />
    </xsl:template>
    <xsl:template match="cp:programM/sp:period">
        <meta name="date" content="{.}" />
    </xsl:template>
    <xsl:template match="sp:abstract">
        <section data-hdoc-type="introduction">
            <header>
                <h1>Introduction</h1>
            </header>
            <!-- a introduction has only a bloc -->
            <div>
                <xsl:apply-templates select="./cp:txtDesc/*"/>
            </div>          
        </section>
    </xsl:template>
Neveux Anais's avatar
Neveux Anais committed
50
51
52
    <xsl:template match="sp:sequence/cp:sequence">
        <section>
            <header>
53
54
                <h1><xsl:value-of select="./cp:sequenceM/sp:title"/></h1>
                <xsl:apply-templates select=".//cp:competence"/>
Neveux Anais's avatar
Neveux Anais committed
55
            </header>
56
57
58
59
60
61
62
63
64
65
66
67
            <xsl:apply-templates select=".//sp:ojectives"/>
            <xsl:apply-templates select="child::*[name()!= 'cp:sequenceM']"/>
        </section>
    </xsl:template>
    <xsl:template match="sp:ojectives">
        <section>
            <header>
                <h1>Objectifs</h1>
            </header>
            <div>
                <xsl:apply-templates select="./cp:txtDesc/*"/>
            </div>
Neveux Anais's avatar
Neveux Anais committed
68
69
70
        </section>
    </xsl:template>
    <xsl:template match="sp:session">
71
72
73
74
75
76
        <section>
            <header>
                <h1><xsl:value-of select="cp:session/cp:sessionM/sp:title"/></h1>
                <!-- gérer les sessionM -->
                
            </header>
77
            <xsl:apply-templates select="cp:session/*[name() != 'cp:sessionM']"/>
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
        </section>
    </xsl:template>
    
    <xsl:template match="sp:profInstruction">
        <div><xsl:apply-templates select="cp:txt/sc:para"/></div>
    </xsl:template>
    
    <!-- ***** TEXT START ***** -->
    
    <!-- Simple text 
    <xsl:template match="cp:res/sp:txt">
        <xsl:apply-templates select="./op:txt/*" />
    </xsl:template>-->
    
    <!-- Paragraph -->
    <xsl:template match="sc:para"> 
        <p>
            <xsl:apply-templates select="./* | ./text()" />
        </p>
    </xsl:template>
    
    <!-- ***** PARAGRAPH ITEMS START ***** -->
    
    <!-- citation -->
    <xsl:template match="sc:para/sc:inlineStyle[@role='quote']" priority="2">
        <q>
            <xsl:value-of select="." />
        </q>
    </xsl:template>
    <!-- important -->
    <xsl:template match="sc:para/sc:inlineStyle[@role='emphasis']" priority="2">
        <em>
            <xsl:value-of select="." />
        </em>
    </xsl:template>
    <!-- foreign term -->
    <xsl:template match="sc:para/sc:inlineStyle[@role='specific']" priority="2">
        <i>
            <xsl:value-of select="." />
        </i>
    </xsl:template>
    <!-- syntax -->
    <xsl:template match="sc:para/sc:inlineStyle[@role='code']" priority="2">
        <span data-hdoc-type="syntax">
            <xsl:value-of select="." />
        </span>
    </xsl:template>
    
    <xsl:template match="sc:para/sc:uLink" priority="2">
        <xsl:value-of select="." />
    </xsl:template>
    <!-- exponent -->
    <xsl:template match="sc:para/sc:textLeaf[@role='exp']" priority="2">
        <sup>
            <xsl:value-of select="." />
        </sup>
    </xsl:template>
    <!-- subscript -->
    <xsl:template match="sc:para/sc:textLeaf[@role='ind']" priority="2">
        <sub>
            <xsl:value-of select="." />
        </sub>
    </xsl:template>
    <!-- latex -->
    <xsl:template match="sc:para/sc:textLeaf[@role='mathtex']" priority="2">
        <span data-hdoc-type="latex">
            <xsl:value-of select="." />
        </span>
    </xsl:template>
    <!-- default behaviour for other balises -->
    <xsl:template match="sc:para/sc:inlineStyle|sc:para/sc:textLeaf" priority="1">
        <xsl:value-of select="." />
    </xsl:template>
    
    <xsl:template match="sc:para/sc:phrase[@role='url']">
        <xsl:apply-templates select="cp:link"/>
    </xsl:template>
    
    <xsl:template match="cp:link">
        <a href="{sp:url/text()}"><xsl:value-of select="sp:title/text()"></xsl:value-of></a>
    </xsl:template>
    
    <!-- ***** PARAGRAPH ITEMS END ***** -->
    
    <!-- List-->
    <xsl:template match="sc:itemizedList">
        <ul>
            <xsl:apply-templates select="./sc:listItem" />
        </ul>
    </xsl:template>
    
    <!-- Ordered list -->
    <xsl:template match="sc:orderedList">
        <ol>
            <xsl:apply-templates select="./sc:listItem" />
        </ol>
    </xsl:template>
    
    <!-- ***** LIST ITEMS START ***** -->
    
    <!-- List item -->
    <xsl:template match="sc:listItem">
        <li>
            <xsl:apply-templates select="./*" />
        </li>
    </xsl:template>
    
    <!-- ***** LIST ITEMS END ***** -->
    
    <!-- Table -->
    <xsl:template match="sc:table">
        <table>
            <xsl:apply-templates select="./*" />
        </table>
    </xsl:template>
    
    <!-- ***** TABLE ITEMS START ***** -->
    
    <!-- caption -->
    <xsl:template match="sc:table/sc:caption">
        <caption>
            <xsl:value-of select="."></xsl:value-of>
        </caption>
    </xsl:template>
    <!-- table row -->
    <xsl:template match="sc:table/sc:row">
        <tr>
            <xsl:apply-templates select="./*" />
        </tr>
    </xsl:template>
    <!-- table cell -->
    <xsl:template match="sc:table/sc:row/sc:cell">
        <td>
            <xsl:apply-templates select="./*" />
        </td>
    </xsl:template>
    
    <!-- ***** TABLE ITEMS END ***** -->
    
    <!-- ***** TEXT END ***** -->
    
Neveux Anais's avatar
Neveux Anais committed
219
220
    
    
221
    <!-- ******** ACTIVITE TETM ********** -->
222
    <xsl:template match="sp:textActivity/cp:textActivity | sc:item/cp:textActivity | sp:section/cp:textActivity">
223
224
225
226
        <section>
            <header>
                <h1><xsl:value-of select="cp:activityM/sp:title"/></h1>
            </header>
227
228
           
            <xsl:apply-templates select="sp:body/cp:blocks/* | sp:section/cp:textActivity"/>
229
230
231
232
233
234
        </section>
    </xsl:template>
    
    <!-- Gestion transclusion d'activite -->
    <xsl:template match="sp:textActivity[@sc:refUri]">
        <xsl:apply-templates select="document(@sc:refUri)"/>
Neveux Anais's avatar
Neveux Anais committed
235
236
    </xsl:template>
    
237
238
239
240
241
242
243
    <!-- Gestion information -->
    <xsl:template match="sp:info">
        <div>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
Neveux Anais's avatar
Neveux Anais committed
244
    </xsl:template>
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
    
    <!-- Gestion warning -->
    <xsl:template match="sp:warning">
        <div data-hdoc-type='warning'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>
    
    <!-- Gestion complement -->
    <xsl:template match="sp:extra">
        <div data-hdoc-type='complement'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>
    
    <!-- Gestion conseil -->
    <xsl:template match="sp:advice">
        <div data-hdoc-type='advice'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>
    
    <!-- Gestion definition -->
    <xsl:template match="sp:definition">
        <div data-hdoc-type='definition'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>
    
    <!-- Gestion exemple -->
    <xsl:template match="sp:example">
        <div data-hdoc-type='example'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>
    
    <!-- Gestion hypothese -->
    <xsl:template match="sp:hypothesis">
        <div data-hdoc-type='remark'>
            <h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
            <!-- TODO gerer plusieurs types de paragraphe -->
            <xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
        </div>
    </xsl:template>

300
301
302
303
304
305
306
307
308
    <!-- Gestion methode -->
    <xsl:template match="sp:method">
        <!-- TODO -->
    </xsl:template>
    
    <!-- Gestion rappel -->
    <xsl:template match="sp:reminder">
        <!-- TODO -->
    </xsl:template>
309
310
311
    
    <!-- ******** FIN ACTIVITE TETM ********** -->
    
Neveux Anais's avatar
Neveux Anais committed
312
</xsl:stylesheet>