comparison software/mpdl-services/mpiwg-mpdl-cms/src/de/mpg/mpiwg/berlin/mpdl/cms/transform/pageTei.xsl @ 23:e845310098ba

diverse Korrekturen
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 27 Nov 2012 12:35:19 +0100
parents
children
comparison
equal deleted inserted replaced
22:6a45a982c333 23:e845310098ba
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="2.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xlink="http://www.w3.org/1999/xlink"
5 xmlns:xs="http://www.w3.org/2001/XMLSchema"
6 xmlns:functx="http://www.functx.com"
7 xmlns:saxon="http://saxon.sf.net/"
8 xmlns:dc="http://purl.org/dc/elements/1.1/"
9 xmlns:dcterms="http://purl.org/dc/terms"
10 xmlns:math="http://www.w3.org/1998/Math/MathML"
11 xmlns:svg="http://www.w3.org/2000/svg"
12 xmlns:xhtml="http://www.w3.org/1999/xhtml"
13 exclude-result-prefixes="xsl xlink xs functx saxon dc dcterms math svg xhtml"
14 >
15
16 <xsl:output method="xhtml" encoding="utf-8"/>
17
18 <xsl:param name="echoFiguresDir"></xsl:param>
19 <xsl:param name="echoPageImgDir"></xsl:param>
20
21 <xsl:variable name="dictionaryServiceName" select="'http://mpdl-service.mpiwg-berlin.mpg.de/mpiwg-mpdl-lt-web/lt/GetDictionaryEntries'"/>
22
23 <xsl:template match="*:TEI">
24 <div>
25 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
26 <xsl:attribute name="class"><xsl:value-of select="'TEI'"/></xsl:attribute>
27 <xsl:apply-templates/>
28 </div>
29 </xsl:template>
30
31 <xsl:template match="*:expan|*:emph|*:q|*:quote|*:reg|*:num">
32 <xsl:element name="span">
33 <xsl:attribute name="class"><xsl:value-of select="name()"/></xsl:attribute>
34 <xsl:copy-of select="@*"/>
35 <xsl:apply-templates/>
36 </xsl:element>
37 </xsl:template>
38
39 <xsl:template match="*:teiHeader">
40 <!-- do nothing -->
41 </xsl:template>
42
43 <xsl:template match="*:text">
44 <xsl:variable name="contentStr" select="normalize-space(string(.))"/>
45 <xsl:variable name="figures" select=".//*:figure|.//*:handwritten"/>
46 <div>
47 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
48 <xsl:attribute name="class"><xsl:value-of select="'text'"/></xsl:attribute>
49 <xsl:apply-templates/>
50 <xsl:if test="$contentStr = '' and empty($figures)"> <!-- test if div only contains empty nodes but no figures -->
51 <div>
52 <xsl:attribute name="class"><xsl:value-of select="'emptyPage'"/></xsl:attribute>
53 <xsl:value-of select="'[Empty page]'"/>
54 </div>
55 </xsl:if>
56 </div>
57 <!-- Dictionary -->
58 <xsl:if test="not(empty(//*:entry))">
59 <xsl:for-each select="//*:entry">
60 <xsl:sort select="*:form/*:orth"/>
61 <xsl:variable name="position" select="position()"/>
62 <span class="entry">
63 <xsl:apply-templates select="*:form"/>
64 <xsl:apply-templates select="*:sense"/>
65 <xsl:if test="not(empty(*:figure))">
66 <span class="entryDiv">
67 <span class="bf"><xsl:value-of select="'Figures: '"/></span>
68 <span class="entryDiv">
69 <xsl:for-each select="*:figure">
70 <xsl:variable name="href" select="*:graphic/@url"/>
71 <xsl:variable name="figDesc" select="string(*:figDesc)"/>
72 <xsl:if test="$href != ''">
73 <div class="figure" style="margin-left:10px;">
74 <a href="{$href}"><img alt="Figure: {$figDesc}" src="{$href}" width="200" height="200"/></a>
75 <br/>
76 <xsl:value-of select="'[Figure]: '"/><xsl:apply-templates select="*:head"/>
77 </div>
78 </xsl:if>
79 </xsl:for-each>
80 </span>
81 </span>
82 </xsl:if>
83 <xsl:if test="not(empty(*:xr))">
84 <span class="entryDiv">
85 <span class="bf"><xsl:value-of select="'References: '"/></span>
86 <span class="entryDiv">
87 <xsl:for-each select="*:xr/*:ref">
88 <li><xsl:apply-templates select="."/></li>
89 </xsl:for-each>
90 </span>
91 </span>
92 </xsl:if>
93 </span>
94 </xsl:for-each>
95 </xsl:if>
96 <!-- Notes -->
97 <xsl:variable name="bottomNotes" select="//*:note[contains(@place, 'foot') or empty(string(@place))]"/>
98 <xsl:variable name="countBottomNotes" select="count($bottomNotes)"/>
99 <xsl:if test="$countBottomNotes > 0">
100 <span class="notes">
101 <xsl:for-each select="$bottomNotes">
102 <xsl:variable name="noteSign"><xsl:value-of select="count(./preceding::*:note) + 1"/></xsl:variable>
103 <span>
104 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
105 <xsl:attribute name="class"><xsl:value-of select="'note'"/></xsl:attribute>
106 <span class="noteSign"><xsl:value-of select="$noteSign"/></span>
107 <span>
108 <xsl:attribute name="class"><xsl:value-of select="'noteBody foot'"/></xsl:attribute>
109 <span class="noteSign"><xsl:value-of select="$noteSign"/></span>
110 <xsl:apply-templates/>
111 </span>
112 </span>
113 </xsl:for-each>
114 </span>
115 </xsl:if>
116 </xsl:template>
117
118 <xsl:template match="*:div">
119 <xsl:if test="node() or normalize-space()"> <!-- test: contains nodes or is not empty -->
120 <div>
121 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
122 <xsl:attribute name="class"><xsl:value-of select="'div'"/></xsl:attribute>
123 <xsl:apply-templates/>
124 </div>
125 </xsl:if>
126 </xsl:template>
127
128 <xsl:template match="*:p">
129 <div>
130 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
131 <xsl:attribute name="class"><xsl:value-of select="'p'"/></xsl:attribute>
132 <xsl:apply-templates/>
133 </div>
134 </xsl:template>
135
136 <xsl:template match="*:pb">
137 <xsl:variable name="number">
138 <xsl:choose>
139 <xsl:when test="not(empty(@n))"><xsl:value-of select="@n"/></xsl:when>
140 <xsl:otherwise><xsl:value-of select="count(./preceding::*:pb) + 1"/></xsl:otherwise>
141 </xsl:choose>
142 </xsl:variable>
143 <xsl:variable name="file">
144 <xsl:choose>
145 <xsl:when test="not(empty(@facs))"><xsl:value-of select="@facs"/></xsl:when>
146 <xsl:otherwise><xsl:value-of select="$number"/></xsl:otherwise>
147 </xsl:choose>
148 </xsl:variable>
149 <span>
150 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
151 <xsl:attribute name="class"><xsl:value-of select="'pb'"/></xsl:attribute>
152 <span>
153 <xsl:attribute name="class"><xsl:value-of select="'src'"/></xsl:attribute>
154 <xsl:attribute name="title"><xsl:value-of select="concat('pageimg/', string($file))"/></xsl:attribute>
155 <span>
156 <xsl:attribute name="class"><xsl:value-of select="'n'"/></xsl:attribute>
157 <xsl:value-of select="$number"/>
158 </span>
159 </span>
160 </span>
161 </xsl:template>
162
163 <xsl:template match="*:head">
164 <div>
165 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
166 <xsl:attribute name="class"><xsl:value-of select="'head bf'"/></xsl:attribute>
167 <xsl:apply-templates/>
168 </div>
169 </xsl:template>
170
171 <xsl:template match="*:figure">
172 <span class="figure">
173 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
174 <xsl:variable name="url">
175 <xsl:choose>
176 <xsl:when test="not(empty(@facs))"><xsl:value-of select="string(@facs)"/></xsl:when>
177 <xsl:otherwise><xsl:value-of select="string(graphic/@url)"/></xsl:otherwise>
178 </xsl:choose>
179 </xsl:variable>
180 <xsl:variable name="fileName" select="concat($echoFiguresDir, '/', $url)"/>
181 <xsl:variable name="digilibUrl">
182 <xsl:choose>
183 <xsl:when test="starts-with($url, 'http')"><xsl:value-of select="$url"/></xsl:when>
184 <xsl:otherwise><xsl:value-of select="concat('http://digilib.mpiwg-berlin.mpg.de/digitallibrary/jquery/digilib.html?fn=', $fileName)"/></xsl:otherwise>
185 </xsl:choose>
186 </xsl:variable>
187 <xsl:variable name="scalerUrl">
188 <xsl:choose>
189 <xsl:when test="starts-with($url, 'http')"><xsl:value-of select="$url"/></xsl:when>
190 <xsl:otherwise><xsl:value-of select="concat('http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn=', $fileName, '&amp;dh=200&amp;dw=200')"/></xsl:otherwise>
191 </xsl:choose>
192 </xsl:variable>
193 <a href="{$digilibUrl}">
194 <img>
195 <xsl:attribute name="src"><xsl:value-of select="$scalerUrl"/></xsl:attribute>
196 </img>
197 </a>
198 <xsl:if test="not(empty(@number))">
199 <span>
200 <xsl:attribute name="class"><xsl:value-of select="'figureNumber'"/></xsl:attribute>
201 <span>
202 <xsl:attribute name="class"><xsl:value-of select="'figureNum'"/></xsl:attribute>
203 <xsl:value-of select="string(@number)"/>
204 </span>
205 <span>
206 <xsl:attribute name="class"><xsl:value-of select="'figureNumText'"/></xsl:attribute>
207 <xsl:value-of select="concat('[', 'Figure', ' ', string(@number), ']')"/>
208 </span>
209 </span>
210 </xsl:if>
211 <xsl:if test="not(empty(*:head))">
212 <span class="caption">
213 <xsl:for-each select="*:head">
214 <xsl:apply-templates/>
215 </xsl:for-each>
216 </span>
217 </xsl:if>
218 </span>
219 </xsl:template>
220
221 <!-- segmentation -->
222 <xsl:template match="*:seg">
223 <span>
224 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
225 <xsl:choose>
226 <xsl:when test="@rend = 'highlight'">
227 <xsl:attribute name="class"><xsl:value-of select="'seg highlight'"/></xsl:attribute>
228 <xsl:apply-templates/>
229 </xsl:when>
230 <xsl:when test="@rend = 'highlightPoint'">
231 <xsl:attribute name="class"><xsl:value-of select="'seg highlightPoint'"/></xsl:attribute>
232 <xsl:apply-templates/>
233 </xsl:when>
234 <xsl:otherwise>
235 <xsl:attribute name="class"><xsl:value-of select="'seg'"/></xsl:attribute>
236 <xsl:apply-templates/>
237 </xsl:otherwise>
238 </xsl:choose>
239 </span>
240 </xsl:template>
241
242 <!-- choice -->
243 <xsl:template match="*:choice">
244 <span>
245 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
246 <xsl:attribute name="class"><xsl:value-of select="'choice'"/></xsl:attribute>
247 <xsl:if test="not(empty(*:orig))">
248 <xsl:apply-templates select="*:orig"/>
249 </xsl:if>
250 <xsl:if test="not(empty(*:abbr))">
251 <xsl:apply-templates select="*:abbr"/>
252 </xsl:if>
253 <xsl:if test="not(empty(*:am))">
254 <xsl:apply-templates select="*:am"/>
255 </xsl:if>
256 <xsl:if test="not(empty(*:sic))">
257 <xsl:apply-templates select="*:sic"/>
258 </xsl:if>
259 </span>
260 </xsl:template>
261
262 <!-- hi (highlighted) -->
263 <xsl:template match="*:hi">
264 <xsl:choose>
265 <xsl:when test="not(empty(@type)) and @type = 'elem'">
266 <div>
267 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
268 <xsl:attribute name="class"><xsl:value-of select="concat('highlight ', @type)"/></xsl:attribute>
269 <xsl:apply-templates/>
270 </div>
271 </xsl:when>
272 <xsl:when test="not(empty(@type)) and @type != 'elem'">
273 <span>
274 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
275 <xsl:attribute name="class"><xsl:value-of select="concat('highlight ', @type)"/></xsl:attribute>
276 <xsl:apply-templates/>
277 </span>
278 </xsl:when>
279 <xsl:when test="@rend = 'initial'">
280 <span>
281 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
282 <xsl:attribute name="class"><xsl:value-of select="'initial'"/></xsl:attribute>
283 <xsl:apply-templates/>
284 </span>
285 </xsl:when>
286 <xsl:when test="@rend = 'bold'">
287 <span>
288 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
289 <xsl:attribute name="class"><xsl:value-of select="'bf'"/></xsl:attribute>
290 <xsl:apply-templates/>
291 </span>
292 </xsl:when>
293 <xsl:otherwise>
294 <span>
295 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
296 <xsl:attribute name="class"><xsl:value-of select="@rend"/></xsl:attribute>
297 <xsl:apply-templates/>
298 </span>
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:template>
302
303 <!-- name (of type: place, person, ...) -->
304 <xsl:template match="*:name">
305 <span>
306 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
307 <xsl:choose>
308 <xsl:when test="@type = 'place'">
309 <xsl:attribute name="class"><xsl:value-of select="'place'"/></xsl:attribute>
310 <xsl:attribute name="title"><xsl:value-of select="'Place'"/></xsl:attribute>
311 <xsl:apply-templates/>
312 </xsl:when>
313 <xsl:when test="@type = 'person'">
314 <xsl:attribute name="class"><xsl:value-of select="'person'"/></xsl:attribute>
315 <xsl:attribute name="title"><xsl:value-of select="'Person'"/></xsl:attribute>
316 <xsl:apply-templates/>
317 </xsl:when>
318 <xsl:when test="@type = 'org'">
319 <xsl:attribute name="class"><xsl:value-of select="'organization'"/></xsl:attribute>
320 <xsl:attribute name="title"><xsl:value-of select="'Organization'"/></xsl:attribute>
321 <xsl:apply-templates/>
322 </xsl:when>
323 <xsl:otherwise>
324 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
325 <xsl:attribute name="class"><xsl:value-of select="@type"/></xsl:attribute>
326 <xsl:apply-templates/>
327 </xsl:otherwise>
328 </xsl:choose>
329 </span>
330 </xsl:template>
331
332 <!-- place, person, ...) -->
333 <xsl:template match="*:placeName">
334 <span>
335 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
336 <xsl:attribute name="class"><xsl:value-of select="'place'"/></xsl:attribute>
337 <xsl:attribute name="title"><xsl:value-of select="concat('Place: ', @type)"/></xsl:attribute>
338 <xsl:apply-templates/>
339 </span>
340 </xsl:template>
341 <xsl:template match="*:persName">
342 <span>
343 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
344 <xsl:attribute name="class"><xsl:value-of select="'person'"/></xsl:attribute>
345 <xsl:attribute name="title"><xsl:value-of select="'Person'"/></xsl:attribute>
346 <xsl:apply-templates/>
347 </span>
348 </xsl:template>
349
350 <!-- term -->
351 <xsl:template match="*:term">
352 <span>
353 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
354 <xsl:attribute name="class"><xsl:value-of select="'term'"/></xsl:attribute>
355 <xsl:attribute name="title"><xsl:value-of select="'Terminology entry'"/></xsl:attribute>
356 <xsl:apply-templates/>
357 </span>
358 </xsl:template>
359
360 <!-- line -->
361 <xsl:template match="*:lg">
362 <div>
363 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
364 <xsl:attribute name="class"><xsl:value-of select="'lg'"/></xsl:attribute>
365 <xsl:apply-templates/>
366 </div>
367 </xsl:template>
368
369 <xsl:template match="*:l">
370 <span>
371 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
372 <xsl:attribute name="class"><xsl:value-of select="'l'"/></xsl:attribute>
373 <xsl:apply-templates/>
374 </span>
375 <br/>
376 </xsl:template>
377
378 <!-- reference -->
379 <xsl:template match="*:ref">
380 <span>
381 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
382 <xsl:attribute name="class"><xsl:value-of select="'ref'"/></xsl:attribute>
383 <xsl:if test="not(empty(@target))">
384 <a class="ref">
385 <xsl:attribute name="href"><xsl:value-of select="@target"/></xsl:attribute>
386 <xsl:apply-templates/>
387 </a>
388 </xsl:if>
389 <xsl:if test="empty(@target)">
390 <xsl:apply-templates/>
391 </xsl:if>
392 </span>
393 </xsl:template>
394
395 <!-- table -->
396 <xsl:template match="*:table">
397 <table>
398 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
399 <xsl:if test="not(empty(head))">
400 <caption align="top"><xsl:apply-templates select="*:head"/></caption>
401 </xsl:if>
402 <xsl:apply-templates select="*:row"/>
403 </table>
404 </xsl:template>
405
406 <xsl:template match="*:row">
407 <tr>
408 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
409 <xsl:choose>
410 <xsl:when test="@role = 'label'">
411 <xsl:attribute name="style"><xsl:value-of select="'font-weight:bold;'"/></xsl:attribute>
412 <xsl:apply-templates/>
413 </xsl:when>
414 <xsl:when test="@role = 'data' or empty(@role)">
415 <xsl:apply-templates/>
416 </xsl:when>
417 <xsl:otherwise>
418 <xsl:apply-templates/>
419 </xsl:otherwise>
420 </xsl:choose>
421 </tr>
422 </xsl:template>
423
424 <xsl:template match="*:cell">
425 <td>
426 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
427 <xsl:choose>
428 <xsl:when test="@role = 'label' and empty(@cols)">
429 <xsl:attribute name="style"><xsl:value-of select="'font-weight:bold;'"/></xsl:attribute>
430 <xsl:apply-templates/>
431 </xsl:when>
432 <xsl:when test="@role = 'label' and not(empty(@cols))">
433 <xsl:attribute name="colspan"><xsl:value-of select="@cols"/></xsl:attribute>
434 <xsl:attribute name="style"><xsl:value-of select="'font-weight:bold;'"/></xsl:attribute>
435 <xsl:apply-templates/>
436 </xsl:when>
437 <xsl:when test="(@role = 'data' or empty(@role)) and empty(@cols)">
438 <xsl:apply-templates/>
439 </xsl:when>
440 <xsl:when test="(@role = 'data' or empty(@role)) and not(empty(@cols))">
441 <xsl:attribute name="colspan"><xsl:value-of select="@cols"/></xsl:attribute>
442 <xsl:apply-templates/>
443 </xsl:when>
444 <xsl:otherwise>
445 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
446 <xsl:apply-templates/>
447 </xsl:otherwise>
448 </xsl:choose>
449 </td>
450 </xsl:template>
451
452 <!-- dictionary -->
453 <xsl:template match="*:entry">
454 <!-- empty: handled in text tag -->
455 </xsl:template>
456
457 <xsl:template match="*:form">
458 <span>
459 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
460 <xsl:attribute name="class"><xsl:value-of select="'form'"/></xsl:attribute>
461 <xsl:apply-templates/>
462 </span>
463 </xsl:template>
464
465 <xsl:template match="*:orth">
466 <span>
467 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
468 <xsl:attribute name="class"><xsl:value-of select="'orth'"/></xsl:attribute>
469 <xsl:apply-templates/>
470 </span>
471 </xsl:template>
472
473 <xsl:template match="*:sense">
474 <span>
475 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
476 <xsl:attribute name="class"><xsl:value-of select="'sense'"/></xsl:attribute>
477 <span class="entryDiv"><xsl:apply-templates select="*:def"/></span>
478 <span class="entryDiv"><xsl:apply-templates select="*:etym"/></span>
479 </span>
480 </xsl:template>
481
482 <xsl:template match="*:def">
483 <span>
484 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
485 <xsl:attribute name="class"><xsl:value-of select="'def'"/></xsl:attribute>
486 <span class="bf"><xsl:value-of select="'Definition: '"/></span>
487 <xsl:apply-templates/>
488 </span>
489 </xsl:template>
490
491 <xsl:template match="*:mentioned">
492 <span>
493 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
494 <xsl:attribute name="class"><xsl:value-of select="'mentioned'"/></xsl:attribute>
495 <xsl:apply-templates/>
496 </span>
497 </xsl:template>
498
499 <xsl:template match="*:etym">
500 <span>
501 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
502 <xsl:attribute name="class"><xsl:value-of select="'etym'"/></xsl:attribute>
503 <span class="bf"><xsl:value-of select="'Etymology: '"/></span>
504 <span class="entryDiv">
505 <xsl:for-each select="*:cit">
506 <li><xsl:apply-templates select="*:quote"/><xsl:value-of select="' ('"/><xsl:apply-templates select="*:def"/><xsl:value-of select="')'"/></li>
507 </xsl:for-each>
508 </span>
509 </span>
510 </xsl:template>
511
512 <xsl:template match="*:cit">
513 <span>
514 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
515 <xsl:attribute name="class"><xsl:value-of select="'cit'"/></xsl:attribute>
516 <xsl:apply-templates/>
517 </span>
518 </xsl:template>
519
520 <!-- MathML -->
521 <xsl:template match="math:*">
522 <xsl:element name="{name()}" namespace="">
523 <xsl:copy-of select="@*"/>
524 <xsl:apply-templates/>
525 </xsl:element>
526 </xsl:template>
527
528 <!-- SVG -->
529 <xsl:template match="svg:*">
530 <xsl:element name="{name()}" namespace="">
531 <xsl:copy-of select="@*"/>
532 <xsl:apply-templates/>
533 </xsl:element>
534 </xsl:template>
535
536 <xsl:template match="*:lb">
537 <br>
538 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
539 <xsl:attribute name="class"><xsl:value-of select="'lb'"/></xsl:attribute>
540 </br>
541 </xsl:template>
542
543 <xsl:template match="*:cb">
544 <br>
545 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
546 <xsl:attribute name="class"><xsl:value-of select="'cb'"/></xsl:attribute>
547 </br>
548 </xsl:template>
549
550 <xsl:template match="*:note">
551 <xsl:variable name="place"><xsl:value-of select="string(@place)"/></xsl:variable>
552 <xsl:variable name="noteSign"><xsl:value-of select="count(./preceding::*:note) + 1"/></xsl:variable>
553 <span>
554 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
555 <xsl:attribute name="class"><xsl:value-of select="'note'"/></xsl:attribute>
556 <span class="noteSign"><xsl:value-of select="$noteSign"/></span>
557 <xsl:if test="$place != '' and $place != 'foot'">
558 <span>
559 <xsl:attribute name="class"><xsl:value-of select="concat('noteBody ', $place)"/></xsl:attribute>
560 <span class="noteSign"><xsl:value-of select="$noteSign"/></span>
561 <xsl:apply-templates/>
562 </span>
563 </xsl:if>
564 </span>
565 </xsl:template>
566
567 <xsl:template match="*:foreign">
568 <xsl:variable name="xmllang" select="@xml:lang"/>
569 <xsl:variable name="language">
570 <xsl:choose>
571 <xsl:when test="not(empty($xmllang))"><xsl:value-of select="$xmllang"/></xsl:when>
572 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
573 </xsl:choose>
574 </xsl:variable>
575 <span>
576 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
577 <xsl:attribute name="class"><xsl:value-of select="concat('foreign ', $language)"/></xsl:attribute>
578 <xsl:apply-templates/>
579 </span>
580 </xsl:template>
581
582 <xsl:template match="*:gap">
583 <span>
584 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
585 <xsl:attribute name="class"><xsl:value-of select="'gap'"/></xsl:attribute>
586 <xsl:if test="not(empty(@extent))"><span class="extent"><xsl:value-of select="string(@extent)"/></span></xsl:if>
587 <xsl:apply-templates/>
588 </span>
589 </xsl:template>
590
591 <xsl:template match="*:s">
592 <span>
593 <xsl:if test="not(empty(@xml:id))"><xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute></xsl:if>
594 <xsl:attribute name="class"><xsl:value-of select="'s'"/></xsl:attribute>
595 <xsl:apply-templates/>
596 </span>
597 </xsl:template>
598
599 <!-- words -->
600 <xsl:template match="*:w">
601 <xsl:variable name="wordLanguage" select="@lang"/>
602 <xsl:variable name="form" select="encode-for-uri(string(@form))"/>
603 <xsl:variable name="dictionary" select="string(@dictionary)"/>
604 <xsl:variable name="displayWordOrig">
605 <xsl:choose>
606 <xsl:when test="not(empty(*:orig))"><xsl:apply-templates select="*:orig/node()"/></xsl:when>
607 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
608 </xsl:choose>
609 </xsl:variable>
610 <xsl:variable name="displayWordReg">
611 <xsl:choose>
612 <xsl:when test="not(empty(*:reg))"><xsl:apply-templates select="*:reg/node()"/></xsl:when>
613 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
614 </xsl:choose>
615 </xsl:variable>
616 <xsl:variable name="displayWordNorm">
617 <xsl:choose>
618 <xsl:when test="not(empty(*:norm))"><xsl:apply-templates select="*:norm/node()"/></xsl:when>
619 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
620 </xsl:choose>
621 </xsl:variable>
622 <xsl:variable name="displayWordUrlEncoded" select="encode-for-uri($displayWordOrig)"/>
623 <xsl:variable name="dictionaryPart">
624 <xsl:choose>
625 <xsl:when test="$dictionary = 'true'">
626 <a class="dictionary">
627 <xsl:attribute name="href"><xsl:value-of select="concat($dictionaryServiceName, '?query=', $form, '&amp;queryDisplay=', $displayWordUrlEncoded, '&amp;language=', $wordLanguage, '&amp;outputFormat=html', '&amp;outputType=morphCompact&amp;outputType=dictFull')"/></xsl:attribute>
628 <span class="orig"><xsl:sequence select="$displayWordOrig"/></span>
629 <span class="reg"><xsl:sequence select="$displayWordReg"/></span>
630 <span class="norm"><xsl:sequence select="$displayWordNorm"/></span>
631 </a>
632 </xsl:when>
633 <xsl:otherwise>
634 <span class="dictionary">
635 <span class="orig"><xsl:sequence select="$displayWordOrig"/></span>
636 <span class="reg"><xsl:sequence select="$displayWordReg"/></span>
637 <span class="norm"><xsl:sequence select="$displayWordNorm"/></span>
638 </span>
639 </xsl:otherwise>
640 </xsl:choose>
641 </xsl:variable>
642 <span class="w">
643 <xsl:sequence select="$dictionaryPart"/>
644 <span class="nodictionary orig"><xsl:sequence select="$displayWordOrig"/></span>
645 <span class="nodictionary reg"><xsl:sequence select="$displayWordReg"/></span>
646 <span class="nodictionary norm"><xsl:sequence select="$displayWordNorm"/></span>
647 </span>
648 </xsl:template>
649
650 </xsl:stylesheet>