Mercurial > hg > mpdl-group
comparison software/eXist/webapp/mpdl/presentation/pageFragmentHtml.xsl @ 11:d6f528ad5d96
TEI Unterst?tzung, Fehlerbehebungen, externe Objekte
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 11 Mar 2011 13:34:02 +0100 |
parents | 1ec29fdd0db8 |
children | 469d927b9ca7 |
comparison
equal
deleted
inserted
replaced
10:59ff47d1e237 | 11:d6f528ad5d96 |
---|---|
9 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util" | 9 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util" |
10 xmlns:text="http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" | 10 xmlns:text="http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" |
11 xmlns:dc="http://purl.org/dc/elements/1.1/" | 11 xmlns:dc="http://purl.org/dc/elements/1.1/" |
12 xmlns:dcterms="http://purl.org/dc/terms" | 12 xmlns:dcterms="http://purl.org/dc/terms" |
13 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" | 13 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" |
14 xmlns:mml="http://www.w3.org/1998/Math/MathML" | 14 xmlns:m="http://www.w3.org/1998/Math/MathML" |
15 xmlns:svg="http://www.w3.org/2000/svg" | |
15 xmlns:xhtml="http://www.w3.org/1999/xhtml"> | 16 xmlns:xhtml="http://www.w3.org/1999/xhtml"> |
16 | 17 |
17 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> | 18 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> |
18 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> | 19 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> |
19 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> | 20 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> |
222 <xsl:variable name="charNorm" select="/result/page/character-normalization"/> | 223 <xsl:variable name="charNorm" select="/result/page/character-normalization"/> |
223 | 224 |
224 <xsl:template match="text" mode="text"> | 225 <xsl:template match="text" mode="text"> |
225 <xsl:apply-templates mode="text"/> | 226 <xsl:apply-templates mode="text"/> |
226 <!-- Notes --> | 227 <!-- Notes --> |
227 <xsl:if test="$collectionName = 'archimedes' and count($notes/*) > 0"> | 228 <xsl:variable name="countEmptyPlaces" select="count($notes/note[empty(@place)])"/> |
229 <xsl:variable name="countBottomPlaces" select="count($notes/note[contains(@place, 'bottom')])"/> | |
230 <xsl:if test="($collectionName = 'archimedes' or $collectionName = 'tei') and count($notes/*) > 0"> | |
228 <div> | 231 <div> |
229 <hr class="notesBottom"/> | 232 <xsl:choose> |
233 <xsl:when test="$countBottomPlaces > 0 or $countEmptyPlaces > 0"> | |
234 <hr class="notesBottom"/> | |
235 </xsl:when> | |
236 <xsl:otherwise></xsl:otherwise> | |
237 </xsl:choose> | |
230 <xsl:for-each select="$notes/note"> | 238 <xsl:for-each select="$notes/note"> |
231 <xsl:variable name="notePos" select="position()"/> | 239 <xsl:variable name="notePos" select="position()"/> |
240 <xsl:variable name="place" select="@place"/> | |
232 <xsl:variable name="label" select="$notePos"/> | 241 <xsl:variable name="label" select="$notePos"/> |
233 <xsl:variable name="uid" select="@uid"/> | 242 <xsl:variable name="uid" select="@uid"/> |
234 <xsl:variable name="modificationDate" select="@modificationDate"/> | 243 <xsl:variable name="modificationDate" select="@modificationDate"/> |
235 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/> | 244 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/> |
236 <p> | 245 <xsl:choose> |
237 <a> | 246 <xsl:when test="$place = '' or empty($place) or $place = 'bottom'"> |
238 <xsl:attribute name="name"><xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/></xsl:attribute> | 247 <p> |
239 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', 'note-', $pageNumber, '-', $label, 'ref')"/></xsl:attribute> | 248 <a> |
240 <xsl:value-of select="concat('[↑ note-', $pageNumber, '-', $label, ']')"/> | 249 <xsl:attribute name="name"><xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/></xsl:attribute> |
241 </a> | 250 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', 'note-', $pageNumber, '-', $label, 'ref')"/></xsl:attribute> |
242 <xsl:value-of select="': '"/> | 251 <xsl:value-of select="concat('[↑ note-', $pageNumber, '-', $label, ']')"/> |
243 <xsl:choose> | 252 </a> |
244 <xsl:when test="$uid = '' or empty($uid)"> | 253 <xsl:value-of select="': '"/> |
245 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | 254 <xsl:choose> |
246 </xsl:when> | 255 <xsl:when test="$uid = '' or empty($uid)"> |
247 <xsl:otherwise> | 256 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> |
248 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | 257 </xsl:when> |
249 <xsl:value-of select="concat(' [external note, ', $uid, ', ', $modificationDate, ']')"/> | 258 <xsl:otherwise> |
250 </xsl:otherwise> | 259 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> |
251 </xsl:choose> | 260 <xsl:value-of select="concat(' [external note, ', $uid, ', ', $modificationDate, ']')"/> |
252 </p> | 261 </xsl:otherwise> |
262 </xsl:choose> | |
263 </p> | |
264 </xsl:when> | |
265 <xsl:otherwise></xsl:otherwise> | |
266 </xsl:choose> | |
253 </xsl:for-each> | 267 </xsl:for-each> |
254 </div> | 268 </div> |
255 </xsl:if> | 269 </xsl:if> |
256 <xsl:if test="$collectionName = 'echo' and count($notes/*) > 0"> | 270 <xsl:if test="$collectionName = 'echo' and count($notes/*) > 0"> |
257 <div> | 271 <div> |
288 </xsl:template> | 302 </xsl:template> |
289 | 303 |
290 <!-- TEI: segmentation --> | 304 <!-- TEI: segmentation --> |
291 <xsl:template match="seg" mode="text"> | 305 <xsl:template match="seg" mode="text"> |
292 <span class="seg"> | 306 <span class="seg"> |
293 <xsl:if test="not(empty(@xlink:href))"> | 307 <xsl:apply-templates mode="text"/> |
294 <a> | |
295 <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute> | |
296 <xsl:apply-templates mode="text"/> | |
297 </a> | |
298 </xsl:if> | |
299 <xsl:if test="empty(@xlink:href)"> | |
300 <xsl:apply-templates mode="text"/> | |
301 </xsl:if> | |
302 </span> | 308 </span> |
303 </xsl:template> | 309 </xsl:template> |
304 | 310 |
305 <xsl:template match="div" mode="text"> | 311 <!-- TEI: choice --> |
306 <xsl:variable name="type" select="@type"/> | 312 <xsl:template match="choice" mode="text"> |
307 <xsl:variable name="level" select="@level"/> | 313 <xsl:if test="not(empty(orig))"> |
308 <xsl:variable name="style" select="@style"/> | 314 <xsl:apply-templates select="orig" mode="text"/> |
309 <xsl:variable name="border" select="@border"/> | 315 </xsl:if> |
310 <xsl:variable name="width" select="@width"/> | 316 <xsl:if test="not(empty(abbr))"> |
311 <xsl:variable name="note" select="note"/> | 317 <xsl:apply-templates select="abbr" mode="text"/> |
312 <xsl:variable name="figure" select="figure"/> | 318 </xsl:if> |
313 <xsl:variable name="floatClassValue"> | 319 <xsl:if test="not(empty(am))"> |
314 <xsl:choose> | 320 <xsl:apply-templates select="am" mode="text"/> |
315 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | 321 </xsl:if> |
316 <xsl:when test="not(empty($figure))"><xsl:value-of select="''"/></xsl:when> | 322 <xsl:if test="not(empty(sic))"> |
317 <xsl:when test="$type = 'float'"><xsl:value-of select="'float left'"/></xsl:when> | 323 <xsl:apply-templates select="sic" mode="text"/> |
318 <xsl:otherwise><xsl:value-of select="'float left'"/></xsl:otherwise> | 324 </xsl:if> |
319 </xsl:choose> | 325 </xsl:template> |
320 </xsl:variable> | 326 |
321 <xsl:variable name="levelClassValue"> | 327 <!-- TEI: hi (highlighted) --> |
322 <xsl:choose> | 328 <xsl:template match="hi" mode="text"> |
323 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | 329 <xsl:choose> |
324 <xsl:when test="$level = '1'"><xsl:value-of select="'level one'"/></xsl:when> | 330 <xsl:when test="@rend = 'initial'"> |
325 <xsl:when test="$level = '2'"><xsl:value-of select="'level two'"/></xsl:when> | 331 <span class="dc-unmodified"><xsl:apply-templates mode="text"/></span> |
326 <xsl:when test="$level = '3'"><xsl:value-of select="'level three'"/></xsl:when> | 332 </xsl:when> |
327 <xsl:when test="$level = '4'"><xsl:value-of select="'level four'"/></xsl:when> | 333 <xsl:otherwise> |
328 <xsl:when test="$level = '5'"><xsl:value-of select="'level five'"/></xsl:when> | 334 <span class="@rend"><xsl:apply-templates mode="text"/></span> |
329 <xsl:when test="$level = '6'"><xsl:value-of select="'level six'"/></xsl:when> | 335 </xsl:otherwise> |
330 <xsl:when test="$level = '7'"><xsl:value-of select="'level seven'"/></xsl:when> | 336 </xsl:choose> |
331 <xsl:when test="$level = '8'"><xsl:value-of select="'level eight'"/></xsl:when> | 337 </xsl:template> |
332 <xsl:when test="$level = '9'"><xsl:value-of select="'level nine'"/></xsl:when> | 338 |
333 <xsl:when test="empty($level)"><xsl:value-of select="''"/></xsl:when> | 339 <!-- TEI: name (of type: place, person, ...) --> |
334 <xsl:otherwise><xsl:value-of select="'level n'"/></xsl:otherwise> | 340 <xsl:template match="name" mode="text"> |
335 </xsl:choose> | 341 <xsl:choose> |
336 </xsl:variable> | 342 <xsl:when test="@type = 'place'"> |
337 <div> | 343 <span class="place" title="Place"><xsl:apply-templates mode="text"/></span> |
338 <xsl:if test="not(empty($style))"><xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute></xsl:if> | 344 </xsl:when> |
339 <xsl:attribute name="class"><xsl:value-of select="concat($floatClassValue, ' ', $levelClassValue)"/></xsl:attribute> | 345 <xsl:when test="@type = 'person'"> |
340 <xsl:apply-templates mode="text"/> | 346 <span class="person" title="Person"><xsl:apply-templates mode="text"/></span> |
341 </div> | 347 </xsl:when> |
342 </xsl:template> | 348 <xsl:when test="@type = 'org'"> |
343 | 349 <span class="organization" title="Organization"><xsl:apply-templates mode="text"/></span> |
344 <xsl:template match="p" mode="text"> | 350 </xsl:when> |
345 <xsl:variable name="style" select="@style"/> | 351 <xsl:otherwise> |
346 <p> | 352 <span class="@type"><xsl:apply-templates mode="text"/></span> |
347 <xsl:if test="not(empty($style))"> | 353 </xsl:otherwise> |
348 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute> | 354 </xsl:choose> |
349 </xsl:if> | 355 </xsl:template> |
350 <xsl:apply-templates mode="text"/> | 356 |
351 </p> | 357 <!-- TEI: place, person, ...) --> |
352 </xsl:template> | 358 <xsl:template match="placeName" mode="text"> |
353 | 359 <span class="place" title="Place: {@type}"><xsl:apply-templates mode="text"/></span> |
354 <xsl:template match="lb" mode="text"> | 360 </xsl:template> |
355 <xsl:variable name="withoutLBs"> | 361 <xsl:template match="persName" mode="text"> |
356 <xsl:choose> | 362 <span class="person" title="Person"><xsl:apply-templates mode="text"/></span> |
357 <xsl:when test="contains($options, 'withoutLBs')"><xsl:value-of select="'true'"/></xsl:when> | 363 </xsl:template> |
358 <xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise> | 364 |
359 </xsl:choose> | 365 <!-- TEI: term --> |
360 </xsl:variable> | 366 <xsl:template match="term" mode="text"> |
361 <xsl:if test="$withoutLBs = 'false'"><br/></xsl:if> | 367 <span class="term" title="Terminology entry"><xsl:apply-templates mode="text"/></span> |
362 <xsl:apply-templates mode="text"/> | 368 </xsl:template> |
363 </xsl:template> | 369 |
364 | 370 <!-- TEI: line --> |
365 <xsl:template match="cb" mode="text"> | 371 <xsl:template match="lg" mode="text"> |
366 <br/><xsl:apply-templates mode="text"/> | 372 <div class="lg"><xsl:apply-templates mode="text"/></div> |
367 </xsl:template> | 373 </xsl:template> |
368 | 374 |
369 <xsl:template match="expan" mode="text"> | 375 <xsl:template match="l" mode="text"> |
370 <xsl:apply-templates mode="text"/><xsl:text> </xsl:text> | 376 <span class="l"><xsl:apply-templates mode="text"/></span><br/> |
371 </xsl:template> | |
372 | |
373 <xsl:template match="note" mode="text"> | |
374 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
375 <xsl:variable name="notePos" select="count(preceding::note[. >> $topPB]) + 1"/> | |
376 <xsl:variable name="href" select="concat('note-', $pageNumber, '-', $notePos)"/> | |
377 <xsl:choose> | |
378 <xsl:when test="$collectionName = 'archimedes'"> | |
379 <a> | |
380 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> | |
381 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> | |
382 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> | |
383 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> | |
384 </a> | |
385 </xsl:when> | |
386 <xsl:when test="$collectionName = 'echo' and not($hasLabel)"> | |
387 <p> | |
388 <xsl:value-of select="'[Note]: '"/> | |
389 <span class="note"><xsl:apply-templates mode="text"/></span> | |
390 </p> | |
391 </xsl:when> | |
392 <xsl:otherwise></xsl:otherwise> | |
393 </xsl:choose> | |
394 </xsl:template> | |
395 | |
396 <xsl:template match="emph" mode="text"> | |
397 <xsl:variable name="class" select="@class"/> | |
398 <xsl:variable name="style" select="@style"/> | |
399 <xsl:variable name="text" select="string-join(., '')"/> | |
400 <xsl:variable name="length" select="string-length($text)"/> | |
401 <xsl:variable name="firstChar" select="substring($text, 1, 1)"/> | |
402 <xsl:variable name="first2Chars" select="substring($text, 1, 2)"/> | |
403 <xsl:variable name="restChars" select="substring($text, 2, $length)"/> | |
404 <xsl:variable name="first2CharsAreUppercase" select="upper-case($first2Chars) = $first2Chars"/> | |
405 <xsl:variable name="rest"> | |
406 <xsl:choose> | |
407 <xsl:when test="$length < 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> | |
408 <xsl:otherwise> | |
409 <xsl:choose> | |
410 <xsl:when test="not(empty(w))"> | |
411 <a class="textPollux" href="lt/wordInfo.xql?language={w/@lang}&word={w/@form}&output=html"><xsl:value-of select="$restChars"/></a> | |
412 </xsl:when> | |
413 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> | |
414 </xsl:choose> | |
415 </xsl:otherwise> | |
416 </xsl:choose> | |
417 </xsl:variable> | |
418 <xsl:if test="$collectionName = 'echo' and not(contains($class, 'sc'))"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
419 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and $first2CharsAreUppercase"><span class="dc {$style}"><xsl:value-of select="$firstChar"/></span><span class="{$class} {$style}"><xsl:sequence select="$rest"/></span></xsl:if> | |
420 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and not($first2CharsAreUppercase)"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
421 <xsl:if test="$collectionName = 'archimedes'"><xsl:apply-templates mode="text"/></xsl:if> | |
422 </xsl:template> | 377 </xsl:template> |
423 | 378 |
424 <!-- TEI: reference --> | 379 <!-- TEI: reference --> |
425 <xsl:template match="ref" mode="text"> | 380 <xsl:template match="ref" mode="text"> |
426 <span class="ref"> | 381 <span class="ref"> |
434 <xsl:apply-templates mode="text"/> | 389 <xsl:apply-templates mode="text"/> |
435 </xsl:if> | 390 </xsl:if> |
436 </span> | 391 </span> |
437 </xsl:template> | 392 </xsl:template> |
438 | 393 |
394 <!-- TEI: table --> | |
395 <xsl:template match="table" mode="text"> | |
396 <table> | |
397 <xsl:if test="not(empty(head))"> | |
398 <caption align="top"><xsl:apply-templates mode="text" select="head"/></caption> | |
399 </xsl:if> | |
400 <xsl:apply-templates mode="text" select="row"/> | |
401 </table> | |
402 </xsl:template> | |
403 | |
404 <xsl:template match="row" mode="text"> | |
405 <xsl:choose> | |
406 <xsl:when test="@role = 'label'"> | |
407 <tr style="font-weight:bold;"><xsl:apply-templates mode="text"/></tr> | |
408 </xsl:when> | |
409 <xsl:when test="@role = 'data' or empty(@role)"> | |
410 <tr><xsl:apply-templates mode="text"/></tr> | |
411 </xsl:when> | |
412 <xsl:otherwise> | |
413 <tr><xsl:apply-templates mode="text"/></tr> | |
414 </xsl:otherwise> | |
415 </xsl:choose> | |
416 </xsl:template> | |
417 | |
418 <xsl:template match="cell" mode="text"> | |
419 <xsl:choose> | |
420 <xsl:when test="@role = 'label' and empty(@cols)"> | |
421 <td style="font-weight:bold;"><xsl:apply-templates mode="text"/></td> | |
422 </xsl:when> | |
423 <xsl:when test="@role = 'label' and not(empty(@cols))"> | |
424 <td colspan="{@cols}" style="font-weight:bold;"><xsl:apply-templates mode="text"/></td> | |
425 </xsl:when> | |
426 <xsl:when test="(@role = 'data' or empty(@role)) and empty(@cols)"> | |
427 <td><xsl:apply-templates mode="text"/></td> | |
428 </xsl:when> | |
429 <xsl:when test="(@role = 'data' or empty(@role)) and not(empty(@cols))"> | |
430 <td colspan="{@cols}"><xsl:apply-templates mode="text"/></td> | |
431 </xsl:when> | |
432 <xsl:otherwise> | |
433 <td><xsl:apply-templates mode="text"/></td> | |
434 </xsl:otherwise> | |
435 </xsl:choose> | |
436 </xsl:template> | |
437 | |
438 <!-- TEI: MathML --> | |
439 <xsl:template match="m:*" mode="text"> | |
440 <xsl:element name="{name()}" namespace=""> | |
441 <xsl:copy-of select="@*"/> | |
442 <xsl:apply-templates mode="text"/> | |
443 </xsl:element> | |
444 </xsl:template> | |
445 | |
446 <!-- TEI: SVG --> | |
447 <xsl:template match="svg:*" mode="text"> | |
448 <xsl:element name="{name()}" namespace=""> | |
449 <xsl:copy-of select="@*"/> | |
450 <xsl:apply-templates mode="text"/> | |
451 </xsl:element> | |
452 </xsl:template> | |
453 | |
454 <xsl:template match="div" mode="text"> | |
455 <xsl:variable name="type" select="@type"/> | |
456 <xsl:variable name="level" select="@level"/> | |
457 <xsl:variable name="style" select="@style"/> | |
458 <xsl:variable name="border" select="@border"/> | |
459 <xsl:variable name="width" select="@width"/> | |
460 <xsl:variable name="note" select="note"/> | |
461 <xsl:variable name="figure" select="figure"/> | |
462 <xsl:variable name="floatClassValue"> | |
463 <xsl:choose> | |
464 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | |
465 <xsl:when test="not(empty($figure))"><xsl:value-of select="''"/></xsl:when> | |
466 <xsl:when test="$type = 'float'"><xsl:value-of select="'float left'"/></xsl:when> | |
467 <xsl:otherwise><xsl:value-of select="'float left'"/></xsl:otherwise> | |
468 </xsl:choose> | |
469 </xsl:variable> | |
470 <xsl:variable name="levelClassValue"> | |
471 <xsl:choose> | |
472 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | |
473 <xsl:when test="$level = '1'"><xsl:value-of select="'level one'"/></xsl:when> | |
474 <xsl:when test="$level = '2'"><xsl:value-of select="'level two'"/></xsl:when> | |
475 <xsl:when test="$level = '3'"><xsl:value-of select="'level three'"/></xsl:when> | |
476 <xsl:when test="$level = '4'"><xsl:value-of select="'level four'"/></xsl:when> | |
477 <xsl:when test="$level = '5'"><xsl:value-of select="'level five'"/></xsl:when> | |
478 <xsl:when test="$level = '6'"><xsl:value-of select="'level six'"/></xsl:when> | |
479 <xsl:when test="$level = '7'"><xsl:value-of select="'level seven'"/></xsl:when> | |
480 <xsl:when test="$level = '8'"><xsl:value-of select="'level eight'"/></xsl:when> | |
481 <xsl:when test="$level = '9'"><xsl:value-of select="'level nine'"/></xsl:when> | |
482 <xsl:when test="empty($level)"><xsl:value-of select="''"/></xsl:when> | |
483 <xsl:otherwise><xsl:value-of select="'level n'"/></xsl:otherwise> | |
484 </xsl:choose> | |
485 </xsl:variable> | |
486 <div> | |
487 <xsl:if test="not(empty($style))"><xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute></xsl:if> | |
488 <xsl:attribute name="class"><xsl:value-of select="concat($floatClassValue, ' ', $levelClassValue)"/></xsl:attribute> | |
489 <xsl:apply-templates mode="text"/> | |
490 </div> | |
491 </xsl:template> | |
492 | |
493 <xsl:template match="p" mode="text"> | |
494 <xsl:variable name="style" select="@style"/> | |
495 <p> | |
496 <xsl:if test="not(empty($style))"> | |
497 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute> | |
498 </xsl:if> | |
499 <xsl:apply-templates mode="text"/> | |
500 </p> | |
501 </xsl:template> | |
502 | |
503 <xsl:template match="lb" mode="text"> | |
504 <xsl:variable name="withoutLBs"> | |
505 <xsl:choose> | |
506 <xsl:when test="contains($options, 'withoutLBs')"><xsl:value-of select="'true'"/></xsl:when> | |
507 <xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise> | |
508 </xsl:choose> | |
509 </xsl:variable> | |
510 <xsl:if test="$withoutLBs = 'false'"><br/></xsl:if> | |
511 <xsl:apply-templates mode="text"/> | |
512 </xsl:template> | |
513 | |
514 <xsl:template match="cb" mode="text"> | |
515 <br/><xsl:apply-templates mode="text"/> | |
516 </xsl:template> | |
517 | |
518 <xsl:template match="expan" mode="text"> | |
519 <xsl:apply-templates mode="text"/> | |
520 </xsl:template> | |
521 | |
522 <xsl:template match="note" mode="text"> | |
523 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
524 <xsl:variable name="place" select="@place"/> | |
525 <xsl:variable name="notePos" select="count(preceding::note[. >> $topPB]) + 1"/> | |
526 <xsl:variable name="href" select="concat('note-', $pageNumber, '-', $notePos)"/> | |
527 <xsl:choose> | |
528 <xsl:when test="$collectionName = 'archimedes'"> | |
529 <a> | |
530 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> | |
531 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> | |
532 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> | |
533 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> | |
534 </a> | |
535 </xsl:when> | |
536 <xsl:when test="$collectionName = 'echo' and not($hasLabel)"> | |
537 <p> | |
538 <xsl:value-of select="'[Note]: '"/> | |
539 <span class="note"><xsl:apply-templates mode="text"/></span> | |
540 </p> | |
541 </xsl:when> | |
542 <xsl:when test="$collectionName = 'tei'"> | |
543 <xsl:choose> | |
544 <xsl:when test="contains($place, 'margin')"> | |
545 <span> | |
546 <xsl:attribute name="class"><xsl:value-of select="concat('note ', $place)"/></xsl:attribute> | |
547 <xsl:apply-templates mode="text"/> | |
548 </span> | |
549 </xsl:when> | |
550 <xsl:otherwise> | |
551 <a> | |
552 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> | |
553 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> | |
554 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> | |
555 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> | |
556 </a> | |
557 </xsl:otherwise> | |
558 </xsl:choose> | |
559 </xsl:when> | |
560 <xsl:otherwise> | |
561 <span class="note"><xsl:apply-templates mode="text"/></span> | |
562 </xsl:otherwise> | |
563 </xsl:choose> | |
564 </xsl:template> | |
565 | |
566 <xsl:template match="emph" mode="text"> | |
567 <xsl:variable name="class" select="@class"/> | |
568 <xsl:variable name="style" select="@style"/> | |
569 <xsl:variable name="text" select="string-join(., '')"/> | |
570 <xsl:variable name="length" select="string-length($text)"/> | |
571 <xsl:variable name="firstChar" select="substring($text, 1, 1)"/> | |
572 <xsl:variable name="first2Chars" select="substring($text, 1, 2)"/> | |
573 <xsl:variable name="restChars" select="substring($text, 2, $length)"/> | |
574 <xsl:variable name="first2CharsAreUppercase" select="upper-case($first2Chars) = $first2Chars"/> | |
575 <xsl:variable name="rest"> | |
576 <xsl:choose> | |
577 <xsl:when test="$length < 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> | |
578 <xsl:otherwise> | |
579 <xsl:choose> | |
580 <xsl:when test="not(empty(w))"> | |
581 <a class="textPollux" href="lt/wordInfo.xql?language={w/@lang}&word={w/@form}&output=html"><xsl:value-of select="$restChars"/></a> | |
582 </xsl:when> | |
583 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> | |
584 </xsl:choose> | |
585 </xsl:otherwise> | |
586 </xsl:choose> | |
587 </xsl:variable> | |
588 <xsl:if test="$collectionName = 'echo' and not(contains($class, 'sc'))"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
589 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and $first2CharsAreUppercase"><span class="dc {$style}"><xsl:value-of select="$firstChar"/></span><span class="{$class} {$style}"><xsl:sequence select="$rest"/></span></xsl:if> | |
590 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and not($first2CharsAreUppercase)"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
591 <xsl:if test="$collectionName = 'archimedes'"><xsl:apply-templates mode="text"/></xsl:if> | |
592 </xsl:template> | |
593 | |
439 <xsl:template match="foreign" mode="text"> | 594 <xsl:template match="foreign" mode="text"> |
440 <xsl:variable name="lang" select="@lang"/> | 595 <xsl:variable name="lang" select="@lang"/> |
441 <xsl:variable name="xmllang" select="@xml:lang"/> | 596 <xsl:variable name="xmllang" select="@xml:lang"/> |
442 <xsl:variable name="language"> | 597 <xsl:variable name="language"> |
443 <xsl:choose> | 598 <xsl:choose> |
451 <xsl:apply-templates mode="text"/> | 606 <xsl:apply-templates mode="text"/> |
452 </span> | 607 </span> |
453 </xsl:template> | 608 </xsl:template> |
454 | 609 |
455 <xsl:template match="q" mode="text"> | 610 <xsl:template match="q" mode="text"> |
456 <div class="q"><xsl:apply-templates mode="text"/></div> | 611 <span class="q"><xsl:apply-templates mode="text"/></span> |
457 </xsl:template> | 612 </xsl:template> |
458 | 613 |
459 <xsl:template match="quote" mode="text"> | 614 <xsl:template match="quote" mode="text"> |
460 <div class="quote"><xsl:apply-templates mode="text"/></div> | 615 <div class="quote"><xsl:apply-templates mode="text"/></div> |
461 </xsl:template> | 616 </xsl:template> |
516 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count($figure/preceding::figure)"/></xsl:when> | 671 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count($figure/preceding::figure)"/></xsl:when> |
517 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> | 672 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> |
518 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::echo:figure[empty(@xlink:label)]) + count(./preceding::echo:anchor[@type = 'figure'])"/></xsl:otherwise> | 673 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::echo:figure[empty(@xlink:label)]) + count(./preceding::echo:anchor[@type = 'figure'])"/></xsl:otherwise> |
519 </xsl:choose> | 674 </xsl:choose> |
520 </xsl:variable> | 675 </xsl:variable> |
521 <xsl:variable name="figureCaption" select="string-join($figure/echo:caption/text(), ' ')"/> | 676 <xsl:variable name="figureCaption"> |
522 <xsl:variable name="figureDescription" select="string-join($figure/echo:description/text(), ' ')"/> | 677 <xsl:choose> |
523 <xsl:variable name="figureVariables" select="string-join($figure/echo:variables/text(), ' ')"/> | 678 <xsl:when test="not(empty($figure/echo:caption))"><xsl:value-of select="string-join($figure/echo:caption/text(), ' ')"/></xsl:when> |
679 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> | |
680 </xsl:choose> | |
681 </xsl:variable> | |
682 <xsl:variable name="figureDescription"> | |
683 <xsl:choose> | |
684 <xsl:when test="not(empty($figure/echo:description))"><xsl:value-of select="string-join($figure/echo:description/text(), ' ')"/></xsl:when> | |
685 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> | |
686 </xsl:choose> | |
687 </xsl:variable> | |
688 <xsl:variable name="figureVariables"> | |
689 <xsl:choose> | |
690 <xsl:when test="not(empty($figure/echo:variables))"><xsl:value-of select="string-join($figure/echo:variables/text(), ' ')"/></xsl:when> | |
691 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> | |
692 </xsl:choose> | |
693 </xsl:variable> | |
524 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float right')"/> | 694 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float right')"/> |
525 </xsl:when> | 695 </xsl:when> |
526 <xsl:when test="$type = 'handwritten'"> | 696 <xsl:when test="$type = 'handwritten'"> |
527 <xsl:variable name="hw" select="$handwritten/echo:handwritten[@xlink:label = $href]"/> | 697 <xsl:variable name="hw" select="$handwritten/echo:handwritten[@xlink:label = $href]"/> |
528 <xsl:variable name="hwFileName" select="$hw/@file"/> | 698 <xsl:variable name="hwFileName" select="$hw/@file"/> |
565 <xsl:choose> | 735 <xsl:choose> |
566 <xsl:when test="$mode = 'textPollux'"> | 736 <xsl:when test="$mode = 'textPollux'"> |
567 <xsl:variable name="baseUrlLex" select="'http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/'"/> | 737 <xsl:variable name="baseUrlLex" select="'http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/'"/> |
568 <xsl:variable name="wordLanguage" select="string-join(w[1]/@lang, '')"/> | 738 <xsl:variable name="wordLanguage" select="string-join(w[1]/@lang, '')"/> |
569 <xsl:variable name="form" select="string-join(w/@form, '')"/> | 739 <xsl:variable name="form" select="string-join(w/@form, '')"/> |
570 <xsl:variable name="wordStr" select="string-join(w, '')"/> | 740 <xsl:variable name="wordStr"> |
741 <xsl:if test="not(empty(w))"> | |
742 <xsl:value-of select="string-join(w, '')"/> | |
743 </xsl:if> | |
744 <xsl:if test="empty(w)"> | |
745 <xsl:value-of select="."/> | |
746 </xsl:if> | |
747 </xsl:variable> | |
571 <xsl:variable name="lexHref"> | 748 <xsl:variable name="lexHref"> |
572 <xsl:if test="not(empty(w))"> | 749 <xsl:if test="not(empty(w))"> |
573 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html', '&placeHref=', encode-for-uri($href))"/> | 750 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html', '&placeHref=', encode-for-uri($href))"/> |
574 </xsl:if> | 751 </xsl:if> |
575 <xsl:if test="empty(w)"> | 752 <xsl:if test="empty(w)"> |
576 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?type=place', '&output=html', '&placeHref=', encode-for-uri($href))"/> | 753 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?type=place', '&language=', $language, '&word=', $wordStr, '&output=html', '&placeHref=', encode-for-uri($href))"/> |
577 </xsl:if> | 754 </xsl:if> |
578 </xsl:variable> | 755 </xsl:variable> |
579 <span class="place"> | 756 <span class="place"> |
580 <a class="textPollux"><xsl:attribute name="href"><xsl:value-of select="$lexHref"/></xsl:attribute><xsl:value-of select="$wordStr"/></a> | 757 <a class="textPollux"><xsl:attribute name="href"><xsl:value-of select="$lexHref"/></xsl:attribute><xsl:value-of select="$wordStr"/></a> |
581 </span> | 758 </span> |
607 <span class="event"> | 784 <span class="event"> |
608 <xsl:apply-templates mode="text"/> | 785 <xsl:apply-templates mode="text"/> |
609 </span> | 786 </span> |
610 </xsl:template> | 787 </xsl:template> |
611 | 788 |
612 <!-- MML --> | |
613 <xsl:template match="mml:*" mode="text"> | |
614 <xsl:copy-of select="."/> | |
615 </xsl:template> | |
616 | |
617 <!-- XHTML: remove the xhtml namespace --> | 789 <!-- XHTML: remove the xhtml namespace --> |
618 <xsl:template match="xhtml:*" mode="text"> | 790 <xsl:template match="xhtml:*" mode="text"> |
619 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | 791 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> |
620 <xsl:variable name="isTable" select="name() = 'table'"/> | 792 <xsl:variable name="isTable" select="name() = 'table'"/> |
621 <xsl:choose> | 793 <xsl:choose> |
635 <xsl:when test="not($hasLabel)"> | 807 <xsl:when test="not($hasLabel)"> |
636 <xsl:variable name="figureFileName"> | 808 <xsl:variable name="figureFileName"> |
637 <xsl:choose> | 809 <xsl:choose> |
638 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace(./@xlink:href, '/', '.')"/></xsl:when> | 810 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace(./@xlink:href, '/', '.')"/></xsl:when> |
639 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="./image/@file"/></xsl:when> | 811 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="./image/@file"/></xsl:when> |
812 <xsl:when test="$collectionName = 'tei'"><xsl:value-of select="@facs"/></xsl:when> | |
640 <xsl:otherwise><xsl:value-of select="./image/@file"/></xsl:otherwise> | 813 <xsl:otherwise><xsl:value-of select="./image/@file"/></xsl:otherwise> |
641 </xsl:choose> | 814 </xsl:choose> |
642 </xsl:variable> | 815 </xsl:variable> |
643 <xsl:variable name="figureNumber"> | 816 <xsl:variable name="figureNumber"> |
644 <xsl:choose> | 817 <xsl:choose> |
645 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure)"/></xsl:when> | 818 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure)"/></xsl:when> |
646 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> | 819 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> |
820 <xsl:when test="$collectionName = 'tei'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure)"/></xsl:when> | |
647 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:otherwise> | 821 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:otherwise> |
648 </xsl:choose> | 822 </xsl:choose> |
649 </xsl:variable> | 823 </xsl:variable> |
650 <xsl:variable name="figureCaption" select="./caption/text()"/> | 824 <xsl:variable name="figureCaption" select="./caption/text()"/> |
651 <xsl:variable name="figureDescription" select="./description/text()"/> | 825 <xsl:variable name="figureDescription" select="./description/text()"/> |