add link tag
[librarian.git] / librarian / xslt / book2html.xslt
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3
4    This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5    Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6
7 -->
8 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9     xmlns:wl="http://wolnelektury.pl/functions"
10     xmlns:dc="http://purl.org/dc/elements/1.1/" >
11
12 <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" />
13 <xsl:strip-space  elements="opowiadanie powiesc dramat_wierszowany_l dramat_wierszowany_lp dramat_wspolczesny liryka_l liryka_lp wywiad"/>
14 <xsl:template match="utwor">
15     <xsl:choose>
16         <xsl:when test="@full-page">
17             <html>
18             <head>
19                 <title>Książka z serwisu WolneLektury.pl</title>
20                 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
21             </head>
22             <style>
23                 body {
24                     font-size: 16px;
25                     font: Georgia, "Times New Roman", serif;
26                     line-height: 1.5em;
27                     margin: 0;
28                 }
29
30                 a {
31                     color: blue;
32                     text-decoration: none;
33                 }
34
35                 #book-text {
36                     margin: 3em;
37                     max-width: 36em;
38                 }
39
40                 /* ================================== */
41                 /* = Header with logo and menu      = */
42                 /* ================================== */
43                 #header {
44                     margin: 3.4em 0 0 1.4em;
45                 }
46
47                 img {
48                     border: none;
49                 }
50
51
52                 #menu {
53                     position: fixed;
54                     left: 0em;
55                     top: 0em;
56                     width: 100%;
57                     height: 1.5em;
58                     background: #333;
59                     color: #FFF;
60                     opacity: 0.9;
61                     z-index: 99;
62                 }
63
64                 #menu ul {
65                     list-style: none;
66                     padding: 0;
67                     margin: 0;
68                 }
69
70                 #menu li a {
71                     display: block;
72                     float: left;
73                     width: 7.5em;
74                     height: 1.5em;
75                     margin-left: 0.5em;
76                     text-align: center;
77                     color: #FFF;
78                 }
79
80                 #menu li a:hover, #menu li a:active {
81                     color: #000;
82                     background: #FFF url(/static/img/arrow-down.png) no-repeat center right;
83                 }
84
85                 #menu li a.selected {
86                     color: #000;
87                     background: #FFF url(/static/img/arrow-up.png) no-repeat center right;
88                 }
89                 #menu a.menu-link {
90                     display: block;
91                     float: left;
92                     height: 1.5em;
93                     margin-left: 0.5em;
94                     text-align: center;
95                     color: #FFF;
96                 }
97                 #menu span {
98                     color: #888;
99                     font-style: italic;
100                     font-size: .75em;
101                     margin-right: 0.5em;
102                 }
103
104
105                 #toc, #themes, #nota_red, #info {
106                     position: fixed;
107                     left: 0em;
108                     top: 1.5em;
109                     width: 37em;
110                     padding: 1.5em;
111                     background: #FFF;
112                     border-bottom: 0.25em solid #DDD;
113                     border-right: 0.25em solid #DDD;
114                     display: none;
115                     height: 16em;
116                     overflow-x: hidden;
117                     overflow-y: auto;
118                     opacity: 0.9;
119                     z-index: 99;
120                 }
121
122                 #toc ol, #themes ol {
123                     list-style: none;
124                     padding: 0;
125                     margin: 0;
126                 }
127
128                 #toc ol li {
129                     font-weight: bold;
130                 }
131
132                 #toc ol ol {
133                     padding: 0 0 1.5em 1.5em;
134                     margin: 0;
135                 }
136
137                 #toc ol ol li {
138                     font-weight: normal;
139                 }
140
141                 #toc h2 {
142                     display: none;
143                 }
144
145                 #toc .anchor {
146                     float: none;
147                     margin: 0;
148                     color: blue;
149                     font-size: 16px;
150                     position: inherit;
151                 }
152
153                 #info p {
154                     text-align: justify;
155                     margin: 1.5em 0 0;
156                 }
157
158                 /* =================================================== */
159                 /* = Common elements: headings, paragraphs and lines = */
160                 /* =================================================== */
161                 h1 {
162                     font-size: 3em;
163                     margin: 1.5em 0;
164                     text-align: center;
165                     line-height: 1.5em;
166                     font-weight: bold;
167                 }
168
169                 h2 {
170                     font-size: 2em;
171                     margin: 1.5em 0 0;
172                     font-weight: bold;
173                     line-height: 1.5em;
174                 }
175
176                 h3 {
177                     font-size: 1.5em;
178                     margin: 1.5em 0 0;
179                     font-weight: normal;
180                     line-height: 1.5em;
181                 }
182
183                 h4 {
184                     font-size: 1em;
185                     margin: 1.5em 0 0;
186                     line-height: 1.5em;
187                 }
188
189                 p {
190                     margin: 0;
191                 }
192
193                 /* ======================== */
194                 /* = Footnotes and themes = */
195                 /* ======================== */
196                 .theme-begin {
197                     border-left: 0.1em solid #DDDDDD;
198                     color: #777;
199                     padding: 0 0.5em;
200                     width: 7.5em;
201
202                     font-style: normal;
203                     font-weight: normal;
204                     font-variant: normal;
205                     letter-spacing: 0;
206                     text-transform: none;
207                     text-decoration: none;
208
209                     font-size: 16px;
210                     float: right;
211                     margin-right: -9.5em;
212                     margin-bottom: 0.5em;
213                     clear: both;
214                     left: 40em;
215                     line-height: 1.5em;
216                     text-align: left;
217                 }
218
219                 .annotation {
220                     font-style: normal;
221                     font-weight: normal;
222                     font-size: 12px;
223                     padding-left: 2px;
224                     position: relative;
225                     top: -4px;
226                 }
227
228                 #footnotes .annotation {
229                     display: block;
230                     float: left;
231                     width: 2.5em;
232                     clear: both;
233                 }
234
235                 #footnotes div {
236                     margin: 1.5em 0 0 0;
237                 }
238
239                 #footnotes p {
240                     margin-left: 2.5em;
241                     font-size: 0.875em;
242                 }
243
244                 blockquote {
245                     font-size: 0.875em;
246                 }
247
248                 /* ============= */
249                 /* = Numbering = */
250                 /* ============= */
251                 .verse, .paragraph {
252                     position:relative;
253                 }
254                 .anchor {
255                     position: absolute;
256                     margin: -0.25em -0.5em;
257                     left: -3em;
258                     color: #777;
259                     font-size: 12px;
260                     width: 2em;
261                     text-align: center;
262                     padding: 0.25em 0.5em;
263                     line-height: 1.5em;
264                 }
265
266                 .anchor:hover, #book-text .anchor:active {
267                     color: #FFF;
268                     background-color: #CCC;
269                 }
270
271                 /* =================== */
272                 /* = Custom elements = */
273                 /* =================== */
274                 span.author {
275                     font-size: 0.5em;
276                     display: block;
277                     line-height: 1.5em;
278                     margin-bottom: 0.25em;
279                 }
280
281                 span.collection {
282                     font-size: 0.375em;
283                     display: block;
284                     line-height: 1.5em;
285                     margin-bottom: -0.25em;
286                 }
287
288                 span.subtitle {
289                     font-size: 0.5em;
290                     display: block;
291                     line-height: 1.5em;
292                     margin-top: -0.25em;
293                 }
294
295                 span.translator {
296                     font-size: 0.375em;
297                     display: block;
298                     line-height: 1.5em;
299                     margin-top: 0.25em;
300                 }
301
302                 div.didaskalia {
303                     font-style: italic;
304                     margin: 0.5em 0 0 1.5em;
305                 }
306
307                 div.kwestia {
308                     margin: 0.5em 0 0;
309                 }
310
311                 div.stanza {
312                     margin: 1.5em 0 0;
313                 }
314
315                 div.kwestia div.stanza {
316                     margin: 0;
317                 }
318
319                 p.paragraph {
320                     text-align: justify;
321                     margin: 1.5em 0 0;
322                 }
323
324                 p.motto {
325                     text-align: justify;
326                     font-style: italic;
327                     margin: 1.5em 0 0;
328                 }
329
330                 p.motto_podpis {
331                     font-size: 0.875em;
332                     text-align: right;
333                 }
334
335                 div.fragment {
336                     border-bottom: 0.1em solid #999;
337                     padding-bottom: 1.5em;
338                 }
339
340                 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
341                     text-align: right;
342                     font-style: italic;
343                 }
344
345                 hr.spacer {
346                     height: 3em;
347                     visibility: hidden;
348                 }
349
350                 hr.spacer-line {
351                     margin: 1.5em 0;
352                     border: none;
353                     border-bottom: 0.1em solid #000;
354                 }
355
356                 p.spacer-asterisk {
357                     padding: 0;
358                     margin: 1.5em 0;
359                     text-align: center;
360                 }
361
362                 div.person-list ol {
363                     list-style: none;
364                     padding: 0 0 0 1.5em;
365                 }
366
367                 p.place-and-time {
368                     font-style: italic;
369                 }
370
371                 em.math, em.foreign-word, em.book-title, em.didaskalia {
372                     font-style: italic;
373                 }
374
375                 em.author-emphasis {
376                     letter-spacing: 0.1em;
377                 }
378
379                 em.person {
380                     font-style: normal;
381                     font-variant: small-caps;
382                 }
383
384                 .verse:after {
385                     content: "\feff";
386                 }
387
388
389                 /* =================================== */
390                 /* = Hide some elements for printing = */
391                 /* =================================== */
392
393                 @media print {
394                     #menu {display: none;}
395                 }
396             </style>
397             <body>
398                 <xsl:call-template name="book-text" />
399             </body>
400             </html>
401         </xsl:when>
402         <xsl:otherwise>
403             <xsl:call-template name="book-text" />
404         </xsl:otherwise>
405     </xsl:choose>
406 </xsl:template>
407
408 <xsl:template name="book-text">
409     <div id="book-text">
410         <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
411         <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
412             <div id="footnotes">
413                 <h3>Przypisy</h3>
414                 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
415                     <div>
416                         <a name="{concat('footnote-', generate-id(.))}" />
417                         <a href="{concat('#anchor-', generate-id(.))}" class="annotation">[<xsl:number value="count(preceding::*[self::pa or self::pe or self::pr or self::pt]) + 1" />]</a>
418                         <xsl:choose>
419                             <xsl:when test="count(akap|akap_cd|strofa) = 0">
420                                 <p><xsl:apply-templates select="text()|*" mode="inline" />
421                                 <xsl:if test="name()='pa'"> [przypis autorski]</xsl:if>
422                                 </p>
423                             </xsl:when>
424                             <xsl:otherwise>
425                                 <xsl:apply-templates select="text()|*" mode="inline" />
426                             </xsl:otherwise>
427                         </xsl:choose>
428                     </div>
429                 </xsl:for-each>
430             </div>
431         </xsl:if>
432     </div>
433 </xsl:template>
434
435
436 <!-- ============================================================================== -->
437 <!-- = MASTER TAG                                                                 = -->
438 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
439 <!-- ============================================================================== -->
440 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
441     <xsl:apply-templates select="nota_red" mode="special" />
442     <xsl:if test="nazwa_utworu">
443         <h1>
444             <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
445             <xsl:call-template name="translators" />
446         </h1>
447     </xsl:if>
448     <xsl:apply-templates />
449 </xsl:template>
450
451
452 <!-- ==================================================================================== -->
453 <!-- = BLOCK TAGS                                                                       = -->
454 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
455 <!-- ==================================================================================== -->
456 <xsl:template match="nota">
457     <div class="note"><xsl:apply-templates /></div>
458 </xsl:template>
459
460 <xsl:template match="lista_osob">
461     <div class="person-list">
462         <h3><xsl:value-of select="naglowek_listy" /></h3>
463         <ol>
464             <xsl:apply-templates select="lista_osoba" />
465         </ol>
466     </div>
467 </xsl:template>
468
469 <xsl:template match="dedykacja">
470     <div class="dedication"><xsl:apply-templates /></div>
471 </xsl:template>
472
473 <xsl:template match="ramka">
474     <div class="frame"><xsl:apply-templates /></div>
475 </xsl:template>
476
477 <xsl:template match="kwestia">
478     <div class="kwestia">
479         <xsl:apply-templates select="strofa|akap|didaskalia" />
480     </div>
481 </xsl:template>
482
483 <xsl:template match="dlugi_cytat|poezja_cyt">
484     <blockquote><xsl:apply-templates /></blockquote>
485 </xsl:template>
486
487 <xsl:template match="motto">
488     <div class="motto"><xsl:apply-templates mode="inline" /></div>
489 </xsl:template>
490
491
492 <xsl:template match="tabela">
493     <table><xsl:apply-templates /></table>
494 </xsl:template>
495 <xsl:template match="wiersz">
496     <tr><xsl:apply-templates /></tr>
497 </xsl:template>
498 <xsl:template match="kol">
499     <td><xsl:apply-templates mode="inline" /></td>
500 </xsl:template>
501
502 <xsl:template match="ilustr" mode="inline">
503     <xsl:apply-templates select="."/>
504 </xsl:template>
505
506 <xsl:template match="ilustr">
507     <img>
508         <xsl:attribute name="src">
509             <xsl:value-of select="@src" />
510         </xsl:attribute>
511                 <xsl:attribute name="alt">
512                             <xsl:value-of select="@alt" />
513                                     </xsl:attribute>
514                                 <xsl:attribute name="title">
515                                                             <xsl:value-of select="@alt" />
516                                                                                                 </xsl:attribute>
517
518
519     </img>
520 </xsl:template>
521 <xsl:template match="lista[@typ='num']">
522     <ol><xsl:apply-templates /></ol>
523 </xsl:template>
524 <xsl:template match="lista[@typ='punkt']">
525     <ul><xsl:apply-templates /></ul>
526     </xsl:template>
527 <xsl:template match="punkt">
528     <li><xsl:apply-templates mode="inline" /></li>
529         </xsl:template>
530
531
532
533
534
535 <!-- ========================================== -->
536 <!-- = PARAGRAPH TAGS                         = -->
537 <!-- = (can contain inline and special tags)  = -->
538 <!-- ========================================== -->
539 <!-- Title page -->
540 <xsl:template match="autor_utworu" mode="header">
541     <span class="author"><xsl:apply-templates mode="inline" /></span>
542 </xsl:template>
543
544 <xsl:template match="nazwa_utworu" mode="header">
545     <span class="title"><xsl:apply-templates mode="inline" /></span>
546 </xsl:template>
547
548 <xsl:template match="dzielo_nadrzedne" mode="header">
549     <span class="collection"><xsl:apply-templates mode="inline" /></span>
550 </xsl:template>
551
552 <xsl:template match="podtytul" mode="header">
553     <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
554 </xsl:template>
555
556 <!-- Section headers (included in index)-->
557 <xsl:template match="naglowek_akt|naglowek_czesc">
558   <xsl:call-template name="section-anchor"/>
559     <h2>
560         <xsl:apply-templates mode="inline" /></h2>
561 </xsl:template>
562
563 <xsl:template match="naglowek_scena|naglowek_rozdzial">
564     <xsl:call-template name="section-anchor"/>
565     <h3><xsl:apply-templates mode="inline" /></h3>
566 </xsl:template>
567
568 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
569       <xsl:call-template name="section-anchor"/>
570     <h4><xsl:apply-templates mode="inline" /></h4>
571 </xsl:template>
572
573 <xsl:template match="srodtytul">
574   <xsl:call-template name="section-anchor"/>
575       <h5>
576                                           <xsl:apply-templates mode="inline" /></h5>
577                                           </xsl:template>
578
579
580 <!-- Other paragraph tags -->
581 <xsl:template match="miejsce_czas">
582       <xsl:call-template name="section-anchor"/>
583     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
584 </xsl:template>
585
586 <xsl:template match="didaskalia">
587       <xsl:call-template name="section-anchor"/>
588     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
589 </xsl:template>
590
591 <xsl:template match="lista_osoba">
592     <li><xsl:apply-templates mode="inline" /></li>
593 </xsl:template>
594
595 <xsl:template match="akap|akap_dialog|akap_cd">
596     <p class="paragraph">
597       <xsl:call-template name="section-anchor"/>
598         <xsl:apply-templates mode="inline" />
599     </p>
600 </xsl:template>
601
602 <xsl:template match="strofa">
603     <div class="stanza">
604       <xsl:call-template name="section-anchor"/>
605         <xsl:choose>
606             <xsl:when test="count(br) > 0">
607                 <xsl:call-template name="verse">
608                     <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
609                     <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
610                 </xsl:call-template>
611                 <xsl:for-each select="br">              
612                                 <!-- Each BR tag "consumes" text after it -->
613                     <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
614                     <xsl:call-template name="verse">
615                         <xsl:with-param name="verse-content"
616                             select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
617                         <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
618                     </xsl:call-template>
619                 </xsl:for-each>
620             </xsl:when>
621             <xsl:otherwise>
622                 <xsl:call-template name="verse">
623                     <xsl:with-param name="verse-content" select="text() | node()" />
624                     <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
625                  </xsl:call-template>
626             </xsl:otherwise>
627         </xsl:choose>
628     </div>
629 </xsl:template>
630
631 <xsl:template name="verse">
632     <xsl:param name="verse-content" />
633     <xsl:param name="verse-type" />
634     <p class="verse">
635         <xsl:choose>
636             <xsl:when test="name($verse-type) = 'wers_akap'">
637                 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
638             </xsl:when>
639             <xsl:when test="name($verse-type) = 'wers_wciety'">
640                 <xsl:choose>
641                     <xsl:when test="$verse-content/@typ">
642                         <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
643                     </xsl:when>
644                     <xsl:otherwise>
645                         <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
646                     </xsl:otherwise>
647                 </xsl:choose>
648             </xsl:when>
649             <xsl:when test="name($verse-type) = 'wers_cd'">
650                 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
651             </xsl:when>
652         </xsl:choose>
653         <xsl:apply-templates select="$verse-content" mode="inline" />
654     </p>
655 </xsl:template>
656
657 <xsl:template match="motto_podpis">
658     <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
659 </xsl:template>
660
661
662 <!-- ================================================ -->
663 <!-- = INLINE TAGS                                  = -->
664 <!-- = (contain other inline tags and special tags) = -->
665 <!-- ================================================ -->
666 <!-- Annotations -->
667 <xsl:template match="pa|pe|pr|pt" mode="inline">
668     <a name="{concat('anchor-', generate-id(.))}" />
669     <a href="{concat('#footnote-', generate-id(.))}" class="annotation">[<xsl:number value="count(preceding::*[self::pa or self::pe or self::pr or self::pt]) + 1" />]</a>
670 </xsl:template>
671
672 <!-- Other inline tags -->
673 <xsl:template match="mat" mode="inline">
674     <em class="math"><xsl:apply-templates mode="inline" /></em>
675 </xsl:template>
676
677 <xsl:template match="didask_tekst" mode="inline">
678     <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
679 </xsl:template>
680
681 <xsl:template match="slowo_obce" mode="inline">
682     <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
683 </xsl:template>
684
685 <xsl:template match="tytul_dziela" mode="inline">
686     <em class="book-title">
687         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
688     </em>
689 </xsl:template>
690
691 <xsl:template match="wyroznienie" mode="inline">
692     <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
693 </xsl:template>
694
695 <xsl:template match="osoba" mode="inline">
696     <em class="person"><xsl:apply-templates mode="inline" /></em>
697 </xsl:template>
698
699 <xsl:template match="www" mode="inline">
700     <a>
701         <xsl:attribute name="href">
702             <xsl:value-of select="text()"/>
703         </xsl:attribute>
704         <xsl:value-of select="text()"/>
705     </a>
706 </xsl:template>
707
708 <xsl:template match="link" mode="inline">
709     <a>
710         <xsl:attribute name="href">
711             <xsl:value-of select="@url"/>
712         </xsl:attribute>
713         <xsl:value-of select="text()"/>
714     </a>
715 </xsl:template>
716
717 <!-- ============================================== -->
718 <!-- = STANDALONE TAGS                            = -->
719 <!-- = (cannot contain any other tags)            = -->
720 <!-- ============================================== -->
721 <xsl:template match="sekcja_swiatlo">
722     <hr class="spacer" />
723 </xsl:template>
724
725 <xsl:template match="sekcja_asterysk">
726     <p class="spacer-asterisk">*</p>
727 </xsl:template>
728
729 <xsl:template match="separator_linia">
730     <hr class="spacer-line" />
731 </xsl:template>
732
733
734 <!-- ================ -->
735 <!-- = SPECIAL TAGS = -->
736 <!-- ================ -->
737 <!-- Themes -->
738 <xsl:template match="begin" mode="inline">
739     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
740     <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
741         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
742     </a>
743 </xsl:template>
744
745 <xsl:template match="end" mode="inline">
746     <span class="theme-end" fid="{substring(@id, 2)}"> </span>
747 </xsl:template>
748
749 <xsl:template match="begin|end">
750     <xsl:apply-templates select='.' mode="inline" />
751 </xsl:template>
752
753 <xsl:template match="motyw" mode="inline" />
754
755
756 <xsl:template match="nota_red" mode="special">
757     <div id="nota_red">
758         <xsl:apply-templates />
759     </div>
760 </xsl:template>
761
762
763 <xsl:template name="translators">
764     <xsl:if test="//dc:contributor.translator">
765         <span class="translator">
766             <xsl:text>tłum. </xsl:text>
767             <xsl:for-each select="//dc:contributor.translator">
768                 <xsl:if test="position() != 1">, </xsl:if>
769                 <xsl:apply-templates mode="person" />
770             </xsl:for-each>
771         </span>
772     </xsl:if>
773 </xsl:template>
774
775 <xsl:template match="text()" mode="person">
776     <xsl:value-of select="wl:person_name(.)" />
777 </xsl:template>
778
779
780 <!-- ================ -->
781 <!-- = IGNORED TAGS = -->
782 <!-- ================ -->
783 <xsl:template match="extra|uwaga" />
784 <xsl:template match="extra|uwaga" mode="inline" />
785
786 <xsl:template match="nota_red" />
787
788 <!-- ======== -->
789 <!-- = TEXT = -->
790 <!-- ======== -->
791 <xsl:template match="text()" />
792 <xsl:template match="text()" mode="inline">
793     <xsl:value-of select="wl:substitute_entities(.)" />
794 </xsl:template>
795
796 <!-- ========= -->
797 <!-- = utils = -->
798 <!-- ========= -->
799 <xsl:template name="section-anchor">
800   <!-- 
801        this formula works as follows:
802        - get all ancestors including self
803        - choose the header (third one from root): utwor/book-type/header
804        - get all preceding siblings
805        - count them
806        - create an <a name="sec123"/> tag.
807   -->
808         <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />
809 </xsl:template>
810
811 </xsl:stylesheet>