epub default cover
[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="kwestia">
474     <div class="kwestia">
475         <xsl:apply-templates select="strofa|akap|didaskalia" />
476     </div>
477 </xsl:template>
478
479 <xsl:template match="dlugi_cytat|poezja_cyt">
480     <blockquote><xsl:apply-templates /></blockquote>
481 </xsl:template>
482
483 <xsl:template match="motto">
484     <div class="motto"><xsl:apply-templates mode="inline" /></div>
485 </xsl:template>
486
487
488 <xsl:template match="tabela">
489     <table><xsl:apply-templates /></table>
490 </xsl:template>
491 <xsl:template match="wiersz">
492     <tr><xsl:apply-templates /></tr>
493 </xsl:template>
494 <xsl:template match="kol">
495     <td><xsl:apply-templates mode="inline" /></td>
496 </xsl:template>
497
498 <xsl:template match="ilustr" mode="inline">
499     <xsl:apply-templates select="."/>
500 </xsl:template>
501
502 <xsl:template match="ilustr">
503     <img>
504         <xsl:attribute name="src">
505             <xsl:value-of select="@src" />
506         </xsl:attribute>
507                 <xsl:attribute name="alt">
508                             <xsl:value-of select="@alt" />
509                                     </xsl:attribute>
510                                 <xsl:attribute name="title">
511                                                             <xsl:value-of select="@alt" />
512                                                                                                 </xsl:attribute>
513
514
515     </img>
516 </xsl:template>
517 <xsl:template match="lista[@typ='num']">
518     <ol><xsl:apply-templates /></ol>
519 </xsl:template>
520 <xsl:template match="lista[@typ='punkt']">
521     <ul><xsl:apply-templates /></ul>
522     </xsl:template>
523 <xsl:template match="punkt">
524     <li><xsl:apply-templates mode="inline" /></li>
525         </xsl:template>
526
527
528
529
530
531 <!-- ========================================== -->
532 <!-- = PARAGRAPH TAGS                         = -->
533 <!-- = (can contain inline and special tags)  = -->
534 <!-- ========================================== -->
535 <!-- Title page -->
536 <xsl:template match="autor_utworu" mode="header">
537     <span class="author"><xsl:apply-templates mode="inline" /></span>
538 </xsl:template>
539
540 <xsl:template match="nazwa_utworu" mode="header">
541     <span class="title"><xsl:apply-templates mode="inline" /></span>
542 </xsl:template>
543
544 <xsl:template match="dzielo_nadrzedne" mode="header">
545     <span class="collection"><xsl:apply-templates mode="inline" /></span>
546 </xsl:template>
547
548 <xsl:template match="podtytul" mode="header">
549     <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
550 </xsl:template>
551
552 <!-- Section headers (included in index)-->
553 <xsl:template match="naglowek_akt|naglowek_czesc">
554   <xsl:call-template name="section-anchor"/>
555     <h2>
556         <xsl:apply-templates mode="inline" /></h2>
557 </xsl:template>
558
559 <xsl:template match="naglowek_scena|naglowek_rozdzial">
560     <xsl:call-template name="section-anchor"/>
561     <h3><xsl:apply-templates mode="inline" /></h3>
562 </xsl:template>
563
564 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
565       <xsl:call-template name="section-anchor"/>
566     <h4><xsl:apply-templates mode="inline" /></h4>
567 </xsl:template>
568
569 <xsl:template match="srodtytul">
570   <xsl:call-template name="section-anchor"/>
571       <h5>
572                                           <xsl:apply-templates mode="inline" /></h5>
573                                           </xsl:template>
574
575
576 <!-- Other paragraph tags -->
577 <xsl:template match="miejsce_czas">
578       <xsl:call-template name="section-anchor"/>
579     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
580 </xsl:template>
581
582 <xsl:template match="didaskalia">
583       <xsl:call-template name="section-anchor"/>
584     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
585 </xsl:template>
586
587 <xsl:template match="lista_osoba">
588     <li><xsl:apply-templates mode="inline" /></li>
589 </xsl:template>
590
591 <xsl:template match="akap|akap_dialog|akap_cd">
592     <p class="paragraph">
593       <xsl:call-template name="section-anchor"/>
594         <xsl:apply-templates mode="inline" />
595     </p>
596 </xsl:template>
597
598 <xsl:template match="strofa">
599     <div class="stanza">
600       <xsl:call-template name="section-anchor"/>
601         <xsl:choose>
602             <xsl:when test="count(br) > 0">
603                 <xsl:call-template name="verse">
604                     <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
605                     <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
606                 </xsl:call-template>
607                 <xsl:for-each select="br">              
608                                 <!-- Each BR tag "consumes" text after it -->
609                     <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
610                     <xsl:call-template name="verse">
611                         <xsl:with-param name="verse-content"
612                             select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
613                         <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]" />
614                     </xsl:call-template>
615                 </xsl:for-each>
616             </xsl:when>
617             <xsl:otherwise>
618                 <xsl:call-template name="verse">
619                     <xsl:with-param name="verse-content" select="text() | node()" />
620                     <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
621                  </xsl:call-template>
622             </xsl:otherwise>
623         </xsl:choose>
624     </div>
625 </xsl:template>
626
627 <xsl:template name="verse">
628     <xsl:param name="verse-content" />
629     <xsl:param name="verse-type" />
630     <p class="verse">
631         <xsl:choose>
632             <xsl:when test="name($verse-type) = 'wers_akap'">
633                 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
634             </xsl:when>
635             <xsl:when test="name($verse-type) = 'wers_wciety'">
636                 <xsl:choose>
637                     <xsl:when test="$verse-content/@typ">
638                         <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
639                     </xsl:when>
640                     <xsl:otherwise>
641                         <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
642                     </xsl:otherwise>
643                 </xsl:choose>
644             </xsl:when>
645             <xsl:when test="name($verse-type) = 'wers_cd'">
646                 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
647             </xsl:when>
648         </xsl:choose>
649         <xsl:apply-templates select="$verse-content" mode="inline" />
650     </p>
651 </xsl:template>
652
653 <xsl:template match="motto_podpis">
654     <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
655 </xsl:template>
656
657
658 <!-- ================================================ -->
659 <!-- = INLINE TAGS                                  = -->
660 <!-- = (contain other inline tags and special tags) = -->
661 <!-- ================================================ -->
662 <!-- Annotations -->
663 <xsl:template match="pa|pe|pr|pt" mode="inline">
664     <a name="{concat('anchor-', generate-id(.))}" />
665     <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>
666 </xsl:template>
667
668 <!-- Other inline tags -->
669 <xsl:template match="mat" mode="inline">
670     <em class="math"><xsl:apply-templates mode="inline" /></em>
671 </xsl:template>
672
673 <xsl:template match="didask_tekst" mode="inline">
674     <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
675 </xsl:template>
676
677 <xsl:template match="slowo_obce" mode="inline">
678     <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
679 </xsl:template>
680
681 <xsl:template match="tytul_dziela" mode="inline">
682     <em class="book-title">
683         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
684     </em>
685 </xsl:template>
686
687 <xsl:template match="wyroznienie" mode="inline">
688     <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
689 </xsl:template>
690
691 <xsl:template match="osoba" mode="inline">
692     <em class="person"><xsl:apply-templates mode="inline" /></em>
693 </xsl:template>
694
695 <xsl:template match="www" mode="inline">
696     <a>
697         <xsl:attribute name="href">
698             <xsl:value-of select="text()"/>
699         </xsl:attribute>
700         <xsl:value-of select="text()"/>
701     </a>
702 </xsl:template>
703
704 <!-- ============================================== -->
705 <!-- = STANDALONE TAGS                            = -->
706 <!-- = (cannot contain any other tags)            = -->
707 <!-- ============================================== -->
708 <xsl:template match="sekcja_swiatlo">
709     <hr class="spacer" />
710 </xsl:template>
711
712 <xsl:template match="sekcja_asterysk">
713     <p class="spacer-asterisk">*</p>
714 </xsl:template>
715
716 <xsl:template match="separator_linia">
717     <hr class="spacer-line" />
718 </xsl:template>
719
720
721 <!-- ================ -->
722 <!-- = SPECIAL TAGS = -->
723 <!-- ================ -->
724 <!-- Themes -->
725 <xsl:template match="begin" mode="inline">
726     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
727     <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
728         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
729     </a>
730 </xsl:template>
731
732 <xsl:template match="end" mode="inline">
733     <span class="theme-end" fid="{substring(@id, 2)}"> </span>
734 </xsl:template>
735
736 <xsl:template match="begin|end">
737     <xsl:apply-templates select='.' mode="inline" />
738 </xsl:template>
739
740 <xsl:template match="motyw" mode="inline" />
741
742
743 <xsl:template match="nota_red" mode="special">
744     <div id="nota_red">
745         <xsl:apply-templates />
746     </div>
747 </xsl:template>
748
749
750 <xsl:template name="translators">
751     <xsl:if test="//dc:contributor.translator">
752         <span class="translator">
753             <xsl:text>tłum. </xsl:text>
754             <xsl:for-each select="//dc:contributor.translator">
755                 <xsl:if test="position() != 1">, </xsl:if>
756                 <xsl:apply-templates mode="person" />
757             </xsl:for-each>
758         </span>
759     </xsl:if>
760 </xsl:template>
761
762 <xsl:template match="text()" mode="person">
763     <xsl:value-of select="wl:person_name(.)" />
764 </xsl:template>
765
766
767 <!-- ================ -->
768 <!-- = IGNORED TAGS = -->
769 <!-- ================ -->
770 <xsl:template match="extra|uwaga" />
771 <xsl:template match="extra|uwaga" mode="inline" />
772
773 <xsl:template match="nota_red" />
774
775 <!-- ======== -->
776 <!-- = TEXT = -->
777 <!-- ======== -->
778 <xsl:template match="text()" />
779 <xsl:template match="text()" mode="inline">
780     <xsl:value-of select="wl:substitute_entities(.)" />
781 </xsl:template>
782
783 <!-- ========= -->
784 <!-- = utils = -->
785 <!-- ========= -->
786 <xsl:template name="section-anchor">
787   <!-- 
788        this formula works as follows:
789        - get all ancestors including self
790        - choose the header (third one from root): utwor/book-type/header
791        - get all preceding siblings
792        - count them
793        - create an <a name="sec123"/> tag.
794   -->
795         <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />
796 </xsl:template>
797
798 </xsl:stylesheet>