comparison software/eXist/webapp/mpdl/presentation/pageFragmentHtml.xsl @ 13:469d927b9ca7

diverse Fehlerbehebungen
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 19 Apr 2011 16:51:59 +0200
parents d6f528ad5d96
children e99964f390e4
comparison
equal deleted inserted replaced
12:fba5577e49d9 13:469d927b9ca7
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:m="http://www.w3.org/1998/Math/MathML" 14 xmlns:math="http://www.w3.org/1998/Math/MathML"
15 xmlns:svg="http://www.w3.org/2000/svg" 15 xmlns:svg="http://www.w3.org/2000/svg"
16 xmlns:xhtml="http://www.w3.org/1999/xhtml"> 16 xmlns:xhtml="http://www.w3.org/1999/xhtml">
17 17
18 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> 18 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" />
19 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> 19 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" />
20 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> 20 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" />
222 <xsl:variable name="notes" select="/result/page/notes"/> 222 <xsl:variable name="notes" select="/result/page/notes"/>
223 <xsl:variable name="charNorm" select="/result/page/character-normalization"/> 223 <xsl:variable name="charNorm" select="/result/page/character-normalization"/>
224 224
225 <xsl:template match="text" mode="text"> 225 <xsl:template match="text" mode="text">
226 <xsl:apply-templates mode="text"/> 226 <xsl:apply-templates mode="text"/>
227 <!-- TEI Dictionary -->
228 <xsl:if test="not(empty(//entry))">
229 <xsl:for-each select="//entry">
230 <xsl:sort select="form/orth"/>
231 <xsl:variable name="position" select="position()"/>
232 <span class="entry">
233 <xsl:apply-templates mode="text" select="form"/>
234 <xsl:apply-templates mode="text" select="sense"/>
235 <xsl:if test="not(empty(figure))">
236 <span class="entryDiv">
237 <span class="bf"><xsl:value-of select="'Figures: '"/></span>
238 <span class="entryDiv">
239 <xsl:for-each select="figure">
240 <xsl:variable name="href" select="graphic/@url"/>
241 <xsl:variable name="head" select="head"/>
242 <xsl:variable name="figDesc" select="string(figDesc)"/>
243 <xsl:if test="$href != ''">
244 <div class="figure" style="margin-left:10px;">
245 <a href="{$href}"><img alt="Figure: {$figDesc}" src="{$href}" width="200" height="200"/></a>
246 <br/>
247 <xsl:value-of select="'[Figure]: '"/><xsl:value-of select="$head"/>
248 </div>
249 </xsl:if>
250 </xsl:for-each>
251 </span>
252 </span>
253 </xsl:if>
254 <xsl:if test="not(empty(xr))">
255 <span class="entryDiv">
256 <span class="bf"><xsl:value-of select="'References: '"/></span>
257 <span class="entryDiv">
258 <xsl:for-each select="xr/ref">
259 <li><xsl:apply-templates mode="text" select="."/></li>
260 </xsl:for-each>
261 </span>
262 </span>
263 </xsl:if>
264 </span>
265 </xsl:for-each>
266 </xsl:if>
227 <!-- Notes --> 267 <!-- Notes -->
228 <xsl:variable name="countEmptyPlaces" select="count($notes/note[empty(@place)])"/> 268 <xsl:variable name="countEmptyPlaces" select="count($notes/note[empty(@place)])"/>
229 <xsl:variable name="countBottomPlaces" select="count($notes/note[contains(@place, 'bottom')])"/> 269 <xsl:variable name="countBottomPlaces" select="count($notes/note[contains(@place, 'bottom')])"/>
230 <xsl:if test="($collectionName = 'archimedes' or $collectionName = 'tei') and count($notes/*) > 0"> 270 <xsl:if test="($collectionName = 'archimedes' or $collectionName = 'tei') and count($notes/*) > 0">
231 <div> 271 <div>
246 <xsl:when test="$place = '' or empty($place) or $place = 'bottom'"> 286 <xsl:when test="$place = '' or empty($place) or $place = 'bottom'">
247 <p> 287 <p>
248 <a> 288 <a>
249 <xsl:attribute name="name"><xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/></xsl:attribute> 289 <xsl:attribute name="name"><xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/></xsl:attribute>
250 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', 'note-', $pageNumber, '-', $label, 'ref')"/></xsl:attribute> 290 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', 'note-', $pageNumber, '-', $label, 'ref')"/></xsl:attribute>
251 <xsl:value-of select="concat('[↑ note-', $pageNumber, '-', $label, ']')"/> 291 <xsl:attribute name="class"><xsl:value-of select="'note'"/></xsl:attribute>
292 <xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/>
252 </a> 293 </a>
253 <xsl:value-of select="': '"/> 294 <xsl:value-of select="': '"/>
254 <xsl:choose> 295 <xsl:choose>
255 <xsl:when test="$uid = '' or empty($uid)"> 296 <xsl:when test="$uid = '' or empty($uid)">
256 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> 297 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span>
277 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/> 318 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/>
278 <p> 319 <p>
279 <a> 320 <a>
280 <xsl:attribute name="name"><xsl:value-of select="$label"/></xsl:attribute> 321 <xsl:attribute name="name"><xsl:value-of select="$label"/></xsl:attribute>
281 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $label, 'ref')"/></xsl:attribute> 322 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $label, 'ref')"/></xsl:attribute>
282 <xsl:value-of select="concat('[↑ ', $label, ']')"/> 323 <xsl:attribute name="class"><xsl:value-of select="'note'"/></xsl:attribute>
324 <xsl:value-of select="$label"/>
283 </a> 325 </a>
284 <xsl:value-of select="': '"/> 326 <xsl:value-of select="': '"/>
285 <xsl:choose> 327 <xsl:choose>
286 <xsl:when test="$uid = '' or empty($uid)"> 328 <xsl:when test="$uid = '' or empty($uid)">
287 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> 329 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span>
301 <p class="bf center"><xsl:apply-templates mode="text"/></p> 343 <p class="bf center"><xsl:apply-templates mode="text"/></p>
302 </xsl:template> 344 </xsl:template>
303 345
304 <!-- TEI: segmentation --> 346 <!-- TEI: segmentation -->
305 <xsl:template match="seg" mode="text"> 347 <xsl:template match="seg" mode="text">
306 <span class="seg"> 348 <xsl:choose>
307 <xsl:apply-templates mode="text"/> 349 <xsl:when test="@rend = 'highlight'">
308 </span> 350 <span class="seg highlight"><xsl:apply-templates mode="text"/></span>
351 </xsl:when>
352 <xsl:when test="@rend = 'highlightPoint'">
353 <span class="seg highlightPoint"><xsl:apply-templates mode="text"/></span>
354 </xsl:when>
355 <xsl:otherwise>
356 <span class="seg"><xsl:apply-templates mode="text"/></span>
357 </xsl:otherwise>
358 </xsl:choose>
309 </xsl:template> 359 </xsl:template>
310 360
311 <!-- TEI: choice --> 361 <!-- TEI: choice -->
312 <xsl:template match="choice" mode="text"> 362 <xsl:template match="choice" mode="text">
313 <xsl:if test="not(empty(orig))"> 363 <xsl:if test="not(empty(orig))">
328 <xsl:template match="hi" mode="text"> 378 <xsl:template match="hi" mode="text">
329 <xsl:choose> 379 <xsl:choose>
330 <xsl:when test="@rend = 'initial'"> 380 <xsl:when test="@rend = 'initial'">
331 <span class="dc-unmodified"><xsl:apply-templates mode="text"/></span> 381 <span class="dc-unmodified"><xsl:apply-templates mode="text"/></span>
332 </xsl:when> 382 </xsl:when>
333 <xsl:otherwise> 383 <xsl:when test="@rend = 'bold'">
334 <span class="@rend"><xsl:apply-templates mode="text"/></span> 384 <span class="bf"><xsl:apply-templates mode="text"/></span>
385 </xsl:when>
386 <xsl:otherwise>
387 <span>
388 <xsl:attribute name="class"><xsl:value-of select="@rend"/></xsl:attribute>
389 <xsl:apply-templates mode="text"/>
390 </span>
335 </xsl:otherwise> 391 </xsl:otherwise>
336 </xsl:choose> 392 </xsl:choose>
337 </xsl:template> 393 </xsl:template>
338 394
339 <!-- TEI: name (of type: place, person, ...) --> 395 <!-- TEI: name (of type: place, person, ...) -->
347 </xsl:when> 403 </xsl:when>
348 <xsl:when test="@type = 'org'"> 404 <xsl:when test="@type = 'org'">
349 <span class="organization" title="Organization"><xsl:apply-templates mode="text"/></span> 405 <span class="organization" title="Organization"><xsl:apply-templates mode="text"/></span>
350 </xsl:when> 406 </xsl:when>
351 <xsl:otherwise> 407 <xsl:otherwise>
352 <span class="@type"><xsl:apply-templates mode="text"/></span> 408 <span>
409 <xsl:attribute name="class"><xsl:value-of select="@type"/></xsl:attribute>
410 <xsl:apply-templates mode="text"/>
411 </span>
353 </xsl:otherwise> 412 </xsl:otherwise>
354 </xsl:choose> 413 </xsl:choose>
355 </xsl:template> 414 </xsl:template>
356 415
357 <!-- TEI: place, person, ...) --> 416 <!-- TEI: place, person, ...) -->
433 <td><xsl:apply-templates mode="text"/></td> 492 <td><xsl:apply-templates mode="text"/></td>
434 </xsl:otherwise> 493 </xsl:otherwise>
435 </xsl:choose> 494 </xsl:choose>
436 </xsl:template> 495 </xsl:template>
437 496
497 <!-- TEI: dictionary -->
498 <xsl:template match="entry" mode="text">
499 <!-- empty: handled in text tag -->
500 </xsl:template>
501
502 <xsl:template match="form" mode="text">
503 <span class="form">
504 <xsl:apply-templates mode="text"/>
505 </span>
506 </xsl:template>
507
508 <xsl:template match="orth" mode="text">
509 <span class="orth">
510 <xsl:apply-templates mode="text"/>
511 </span>
512 </xsl:template>
513
514 <xsl:template match="sense" mode="text">
515 <span class="entryDiv"><xsl:apply-templates mode="text" select="def"/></span>
516 <span class="entryDiv"><xsl:apply-templates mode="text" select="etym"/></span>
517 </xsl:template>
518
519 <xsl:template match="def" mode="text">
520 <span class="def">
521 <span class="bf"><xsl:value-of select="'Definition: '"/></span>
522 <xsl:apply-templates mode="text"/>
523 </span>
524 </xsl:template>
525
526 <xsl:template match="mentioned" mode="text">
527 <span class="mentioned">
528 <xsl:apply-templates mode="text"/>
529 </span>
530 </xsl:template>
531
532 <xsl:template match="etym" mode="text">
533 <span class="etym">
534 <span class="bf"><xsl:value-of select="'Etymology: '"/></span>
535 <span class="entryDiv">
536 <xsl:for-each select="cit">
537 <li><xsl:value-of select="quote"/><xsl:value-of select="' ('"/><xsl:value-of select="def"/><xsl:value-of select="')'"/></li>
538 </xsl:for-each>
539 </span>
540 </span>
541 </xsl:template>
542
543 <xsl:template match="cit" mode="text">
544 <span class="cit">
545 <xsl:apply-templates mode="text"/>
546 </span>
547 </xsl:template>
548
438 <!-- TEI: MathML --> 549 <!-- TEI: MathML -->
439 <xsl:template match="m:*" mode="text"> 550 <xsl:template match="math:*" mode="text">
440 <xsl:element name="{name()}" namespace=""> 551 <xsl:element name="{name()}" namespace="">
441 <xsl:copy-of select="@*"/> 552 <xsl:copy-of select="@*"/>
442 <xsl:apply-templates mode="text"/> 553 <xsl:apply-templates mode="text"/>
443 </xsl:element> 554 </xsl:element>
444 </xsl:template> 555 </xsl:template>
490 </div> 601 </div>
491 </xsl:template> 602 </xsl:template>
492 603
493 <xsl:template match="p" mode="text"> 604 <xsl:template match="p" mode="text">
494 <xsl:variable name="style" select="@style"/> 605 <xsl:variable name="style" select="@style"/>
495 <p> 606 <xsl:choose>
496 <xsl:if test="not(empty($style))"> 607 <xsl:when test="not(empty($style))">
497 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute> 608 <div>
498 </xsl:if> 609 <xsl:attribute name="class"><xsl:value-of select="'p'"/></xsl:attribute>
499 <xsl:apply-templates mode="text"/> 610 <span>
500 </p> 611 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute>
612 <xsl:apply-templates mode="text"/>
613 </span>
614 </div>
615 </xsl:when>
616 <xsl:otherwise>
617 <div>
618 <xsl:attribute name="class"><xsl:value-of select="'p'"/></xsl:attribute>
619 <xsl:apply-templates mode="text"/>
620 </div>
621 </xsl:otherwise>
622 </xsl:choose>
501 </xsl:template> 623 </xsl:template>
502 624
503 <xsl:template match="lb" mode="text"> 625 <xsl:template match="lb" mode="text">
504 <xsl:variable name="withoutLBs"> 626 <xsl:variable name="withoutLBs">
505 <xsl:choose> 627 <xsl:choose>
527 <xsl:choose> 649 <xsl:choose>
528 <xsl:when test="$collectionName = 'archimedes'"> 650 <xsl:when test="$collectionName = 'archimedes'">
529 <a> 651 <a>
530 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> 652 <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> 653 <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> 654 <xsl:attribute name="class"><xsl:value-of select="'noteRef super'"/></xsl:attribute>
533 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> 655 <xsl:value-of select="$href"/>
534 </a> 656 </a>
535 </xsl:when> 657 </xsl:when>
536 <xsl:when test="$collectionName = 'echo' and not($hasLabel)"> 658 <xsl:when test="$collectionName = 'echo' and not($hasLabel)">
537 <p> 659 <p>
538 <xsl:value-of select="'[Note]: '"/> 660 <xsl:value-of select="'[Note]: '"/>
549 </xsl:when> 671 </xsl:when>
550 <xsl:otherwise> 672 <xsl:otherwise>
551 <a> 673 <a>
552 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> 674 <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> 675 <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> 676 <xsl:attribute name="class"><xsl:value-of select="'noteRef super'"/></xsl:attribute>
555 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> 677 <xsl:value-of select="$href"/>
556 </a> 678 </a>
557 </xsl:otherwise> 679 </xsl:otherwise>
558 </xsl:choose> 680 </xsl:choose>
559 </xsl:when> 681 </xsl:when>
560 <xsl:otherwise> 682 <xsl:otherwise>
562 </xsl:otherwise> 684 </xsl:otherwise>
563 </xsl:choose> 685 </xsl:choose>
564 </xsl:template> 686 </xsl:template>
565 687
566 <xsl:template match="emph" mode="text"> 688 <xsl:template match="emph" mode="text">
567 <xsl:variable name="class" select="@class"/>
568 <xsl:variable name="style" select="@style"/> 689 <xsl:variable name="style" select="@style"/>
690 <xsl:variable name="styleWithoutSC" select="replace($style, 'sc ', '')"/>
569 <xsl:variable name="text" select="string-join(., '')"/> 691 <xsl:variable name="text" select="string-join(., '')"/>
570 <xsl:variable name="length" select="string-length($text)"/> 692 <xsl:variable name="length" select="string-length($text)"/>
571 <xsl:variable name="firstChar" select="substring($text, 1, 1)"/> 693 <xsl:variable name="firstChar" select="substring($text, 1, 1)"/>
572 <xsl:variable name="first2Chars" select="substring($text, 1, 2)"/> 694 <xsl:variable name="first2Chars" select="substring($text, 1, 2)"/>
573 <xsl:variable name="restChars" select="substring($text, 2, $length)"/> 695 <xsl:variable name="restChars" select="substring($text, 2, $length)"/>
576 <xsl:choose> 698 <xsl:choose>
577 <xsl:when test="$length &lt; 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> 699 <xsl:when test="$length &lt; 2 or empty($length)"><xsl:value-of select="''"/></xsl:when>
578 <xsl:otherwise> 700 <xsl:otherwise>
579 <xsl:choose> 701 <xsl:choose>
580 <xsl:when test="not(empty(w))"> 702 <xsl:when test="not(empty(w))">
581 <a class="textPollux" href="lt/wordInfo.xql?language={w/@lang}&amp;word={w/@form}&amp;output=html"><xsl:value-of select="$restChars"/></a> 703 <a class="textPollux" href="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql?language={w/@lang}&amp;word={w/@form}&amp;output=html"><xsl:value-of select="$restChars"/></a>
582 </xsl:when> 704 </xsl:when>
583 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> 705 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise>
584 </xsl:choose> 706 </xsl:choose>
585 </xsl:otherwise> 707 </xsl:otherwise>
586 </xsl:choose> 708 </xsl:choose>
587 </xsl:variable> 709 </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> 710 <xsl:choose>
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> 711 <xsl:when test="$collectionName = 'echo' and not(contains($style, 'sc'))">
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> 712 <span class="{$style}"><xsl:apply-templates mode="text"/></span>
591 <xsl:if test="$collectionName = 'archimedes'"><xsl:apply-templates mode="text"/></xsl:if> 713 </xsl:when>
714 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and $first2CharsAreUppercase">
715 <span class="dc"><xsl:value-of select="$firstChar"/></span><span class="sc"><xsl:sequence select="$rest"/></span>
716 </xsl:when>
717 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and $first2CharsAreUppercase">
718 <span class="dc"><span class="{$styleWithoutSC}"><xsl:value-of select="$firstChar"/></span></span><span class="sc"><span class="{$styleWithoutSC}"><xsl:sequence select="$rest"/></span></span>
719 </xsl:when>
720 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and not($first2CharsAreUppercase)">
721 <xsl:apply-templates mode="text"/>
722 </xsl:when>
723 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and not($first2CharsAreUppercase)">
724 <span class="sc"><span class="{$styleWithoutSC}"><xsl:apply-templates mode="text"/></span></span>
725 </xsl:when>
726 <xsl:when test="$collectionName = 'archimedes'">
727 <xsl:apply-templates mode="text"/>
728 </xsl:when>
729 <xsl:otherwise><xsl:apply-templates mode="text"/></xsl:otherwise>
730 </xsl:choose>
592 </xsl:template> 731 </xsl:template>
593 732
594 <xsl:template match="foreign" mode="text"> 733 <xsl:template match="foreign" mode="text">
595 <xsl:variable name="lang" select="@lang"/> 734 <xsl:variable name="lang" select="@lang"/>
596 <xsl:variable name="xmllang" select="@xml:lang"/> 735 <xsl:variable name="xmllang" select="@xml:lang"/>
671 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count($figure/preceding::figure)"/></xsl:when> 810 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count($figure/preceding::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> 811 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when>
673 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::echo:figure[empty(@xlink:label)]) + count(./preceding::echo:anchor[@type = 'figure'])"/></xsl:otherwise> 812 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::echo:figure[empty(@xlink:label)]) + count(./preceding::echo:anchor[@type = 'figure'])"/></xsl:otherwise>
674 </xsl:choose> 813 </xsl:choose>
675 </xsl:variable> 814 </xsl:variable>
676 <xsl:variable name="figureCaption"> 815 <xsl:variable name="figureCaption"><xsl:apply-templates mode="text" select="$figure/echo:caption"/></xsl:variable>
677 <xsl:choose> 816 <xsl:variable name="figureDescription">
678 <xsl:when test="not(empty($figure/echo:caption))"><xsl:value-of select="string-join($figure/echo:caption/text(), ' ')"/></xsl:when> 817 <xsl:for-each select="$figure/echo:description">
679 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> 818 <xsl:apply-templates mode="text" select="."/><br/>
680 </xsl:choose> 819 </xsl:for-each>
681 </xsl:variable> 820 </xsl:variable>
682 <xsl:variable name="figureDescription"> 821 <xsl:variable name="figureVariables"><xsl:apply-templates mode="text" select="$figure/echo:variables"/></xsl:variable>
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>
694 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float right')"/> 822 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float right')"/>
695 </xsl:when> 823 </xsl:when>
696 <xsl:when test="$type = 'handwritten'"> 824 <xsl:when test="$type = 'handwritten'">
697 <xsl:variable name="hw" select="$handwritten/echo:handwritten[@xlink:label = $href]"/> 825 <xsl:variable name="hw" select="$handwritten/echo:handwritten[@xlink:label = $href]"/>
698 <xsl:variable name="hwFileName" select="$hw/@file"/> 826 <xsl:variable name="hwFileName" select="$hw/@file"/>
705 </xsl:when> 833 </xsl:when>
706 <xsl:when test="$type = 'note'"> 834 <xsl:when test="$type = 'note'">
707 <a> 835 <a>
708 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> 836 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute>
709 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> 837 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute>
710 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> 838 <xsl:attribute name="class"><xsl:value-of select="'noteRef super'"/></xsl:attribute>
711 <xsl:value-of select="concat('↓ (', $href, ')')"/> 839 <xsl:value-of select="$href"/>
712 </a> 840 </a>
713 </xsl:when> 841 </xsl:when>
714 <xsl:otherwise><a><xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute><xsl:apply-templates mode="text"/></a></xsl:otherwise> 842 <xsl:otherwise><a><xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute><xsl:apply-templates mode="text"/></a></xsl:otherwise>
715 </xsl:choose> 843 </xsl:choose>
716 </xsl:template> 844 </xsl:template>
752 <xsl:if test="empty(w)"> 880 <xsl:if test="empty(w)">
753 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?type=place', '&amp;language=', $language, '&amp;word=', $wordStr, '&amp;output=html', '&amp;placeHref=', encode-for-uri($href))"/> 881 <xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?type=place', '&amp;language=', $language, '&amp;word=', $wordStr, '&amp;output=html', '&amp;placeHref=', encode-for-uri($href))"/>
754 </xsl:if> 882 </xsl:if>
755 </xsl:variable> 883 </xsl:variable>
756 <span class="place"> 884 <span class="place">
757 <a class="textPollux"><xsl:attribute name="href"><xsl:value-of select="$lexHref"/></xsl:attribute><xsl:value-of select="$wordStr"/></a> 885 <a class="place"><xsl:attribute name="href"><xsl:value-of select="$lexHref"/></xsl:attribute><xsl:value-of select="$wordStr"/></a>
758 </span> 886 </span>
759 </xsl:when> 887 </xsl:when>
760 <xsl:when test="$mode = 'gis'"> 888 <xsl:when test="$mode = 'gis'">
761 <a><xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute><xsl:apply-templates mode="text"/></a> 889 <a><xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute><xsl:apply-templates mode="text"/></a>
762 </xsl:when> 890 </xsl:when>
802 </xsl:template> 930 </xsl:template>
803 931
804 <xsl:template match="figure" mode="text"> 932 <xsl:template match="figure" mode="text">
805 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> 933 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/>
806 <xsl:choose> 934 <xsl:choose>
807 <xsl:when test="not($hasLabel)"> 935 <xsl:when test="not($hasLabel) and $collectionName != 'tei'">
808 <xsl:variable name="figureFileName"> 936 <xsl:variable name="figureFileName">
809 <xsl:choose> 937 <xsl:choose>
810 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace(./@xlink:href, '/', '.')"/></xsl:when> 938 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace(./@xlink:href, '/', '.')"/></xsl:when>
811 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="./image/@file"/></xsl:when> 939 <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>
813 <xsl:otherwise><xsl:value-of select="./image/@file"/></xsl:otherwise> 940 <xsl:otherwise><xsl:value-of select="./image/@file"/></xsl:otherwise>
814 </xsl:choose> 941 </xsl:choose>
815 </xsl:variable> 942 </xsl:variable>
816 <xsl:variable name="figureNumber"> 943 <xsl:variable name="figureNumber">
817 <xsl:choose> 944 <xsl:choose>
818 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure)"/></xsl:when> 945 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count(./preceding::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> 946 <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>
821 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:otherwise> 947 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:otherwise>
822 </xsl:choose> 948 </xsl:choose>
823 </xsl:variable> 949 </xsl:variable>
824 <xsl:variable name="figureCaption" select="./caption/text()"/> 950 <xsl:variable name="figureCaption"><xsl:apply-templates mode="text" select="caption"/></xsl:variable>
825 <xsl:variable name="figureDescription" select="./description/text()"/> 951 <xsl:variable name="figureDescription">
826 <xsl:variable name="figureVariables" select="./variables/text()"/> 952 <xsl:for-each select="description">
953 <xsl:apply-templates mode="text" select="."/><br/>
954 </xsl:for-each>
955 </xsl:variable>
956 <xsl:variable name="figureVariables"><xsl:apply-templates mode="text" select="variables"/></xsl:variable>
827 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float none')"/> 957 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float none')"/>
828 </xsl:when> 958 </xsl:when>
959 <xsl:when test="not($hasLabel) and $collectionName = 'tei'">
960 <xsl:variable name="figureNumber" select="$firstFigurePosition + count(./preceding::figure)"/>
961 <xsl:choose>
962 <xsl:when test="@facs != ''">
963 <xsl:sequence select="mpdl:showFigure($digilibAvailable, @facs, $figureNumber, '', '', '', 'float none')"/>
964 </xsl:when>
965 <xsl:otherwise>
966 <xsl:variable name="href" select="graphic/@url"/>
967 <xsl:variable name="head" select="head"/>
968 <xsl:variable name="figDesc" select="string(figDesc)"/>
969 <div class="figure" style="margin-left:10px;">
970 <a href="{$href}"><img alt="Figure: {$figDesc}" src="{$href}" width="200" height="200"/></a>
971 <br/>
972 <xsl:value-of select="concat('[Figure ', $figureNumber, ']: ')"/><xsl:value-of select="$head"/>
973 </div>
974 </xsl:otherwise>
975 </xsl:choose>
976 </xsl:when>
829 <xsl:otherwise></xsl:otherwise> 977 <xsl:otherwise></xsl:otherwise>
830 </xsl:choose> 978 </xsl:choose>
979 </xsl:template>
980
981 <xsl:template match="caption" mode="text">
982 <span class="figureCaption"><xsl:apply-templates mode="text"/></span>
983 </xsl:template>
984
985 <xsl:template match="description" mode="text">
986 <span class="figureDescription"><xsl:apply-templates mode="text"/></span>
831 </xsl:template> 987 </xsl:template>
832 988
833 <xsl:template match="handwritten" mode="text"> 989 <xsl:template match="handwritten" mode="text">
834 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> 990 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/>
835 <xsl:choose> 991 <xsl:choose>
846 <!-- textPollux links --> 1002 <!-- textPollux links -->
847 <xsl:template match="w" mode="text"> 1003 <xsl:template match="w" mode="text">
848 <xsl:variable name="baseUrlLex" select="'http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/'"/> 1004 <xsl:variable name="baseUrlLex" select="'http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/'"/>
849 <xsl:variable name="wordLanguage" select="@lang"/> 1005 <xsl:variable name="wordLanguage" select="@lang"/>
850 <xsl:variable name="form" select="@form"/> 1006 <xsl:variable name="form" select="@form"/>
851 <a class="textPollux"> 1007 <xsl:choose>
852 <xsl:attribute name="href"><xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?language=', $wordLanguage, '&amp;word=', $form, '&amp;output=html')"/></xsl:attribute> 1008 <xsl:when test="not(empty(anchor))">
853 <xsl:apply-templates mode="text"/> 1009 <xsl:for-each select="node()">
854 </a> 1010 <xsl:choose>
1011 <xsl:when test=". instance of text()">
1012 <a class="textPollux">
1013 <xsl:attribute name="href"><xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?language=', $wordLanguage, '&amp;word=', $form, '&amp;output=html')"/></xsl:attribute>
1014 <xsl:apply-templates mode="text" select="."/>
1015 </a>
1016 </xsl:when>
1017 <xsl:otherwise>
1018 <xsl:apply-templates mode="text" select="."/>
1019 </xsl:otherwise>
1020 </xsl:choose>
1021 </xsl:for-each>
1022 </xsl:when>
1023 <xsl:otherwise>
1024 <a class="textPollux">
1025 <xsl:attribute name="href"><xsl:value-of select="concat($baseUrlLex, 'lt/wordInfo.xql?language=', $wordLanguage, '&amp;word=', $form, '&amp;output=html')"/></xsl:attribute>
1026 <xsl:apply-templates mode="text"/>
1027 </a>
1028 </xsl:otherwise>
1029 </xsl:choose>
855 </xsl:template> 1030 </xsl:template>
856 1031
857 <xsl:template match="s" mode="text"> 1032 <xsl:template match="s" mode="text">
1033 <xsl:variable name="style" select="@style"/>
858 <xsl:variable name="actualSN"> 1034 <xsl:variable name="actualSN">
859 <xsl:choose> 1035 <xsl:choose>
860 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> 1036 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when>
861 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> 1037 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise>
862 </xsl:choose> 1038 </xsl:choose>
865 <xsl:choose> 1041 <xsl:choose>
866 <!-- Show the sentence in color light grey if it is given as sn --> 1042 <!-- Show the sentence in color light grey if it is given as sn -->
867 <xsl:when test="$sn >= 0 and $sn = $actualSN"> 1043 <xsl:when test="$sn >= 0 and $sn = $actualSN">
868 <span class="s highlight"> 1044 <span class="s highlight">
869 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> 1045 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if>
870 <xsl:apply-templates mode="text"/> 1046 <xsl:choose>
1047 <xsl:when test="empty(@style)">
1048 <xsl:apply-templates mode="text"/>
1049 </xsl:when>
1050 <xsl:otherwise>
1051 <span class="{$style}"><xsl:apply-templates mode="text"/></span>
1052 </xsl:otherwise>
1053 </xsl:choose>
871 </span> 1054 </span>
872 </xsl:when> 1055 </xsl:when>
873 <xsl:otherwise> 1056 <xsl:otherwise>
874 <span class="s"> 1057 <span class="s">
875 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> 1058 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if>
876 <xsl:apply-templates mode="text"/> 1059 <xsl:choose>
1060 <xsl:when test="empty(@style)">
1061 <xsl:apply-templates mode="text"/>
1062 </xsl:when>
1063 <xsl:otherwise>
1064 <span class="{$style}"><xsl:apply-templates mode="text"/></span>
1065 </xsl:otherwise>
1066 </xsl:choose>
877 </span> 1067 </span>
878 </xsl:otherwise> 1068 </xsl:otherwise>
879 </xsl:choose> 1069 </xsl:choose>
880 </xsl:template> 1070 </xsl:template>
881 1071