1 <?xml version="1.0" encoding="utf-8"?>
4 This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
8 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:wl="http://wolnelektury.pl/functions" >
11 <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" />
12 <xsl:template match="utwor">
15 <title>Książka z serwisu WolneLektury.pl</title>
16 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
21 font: Georgia, "Times New Roman", serif;
28 text-decoration: none;
36 /* ================================== */
37 /* = Header with logo and menu = */
38 /* ================================== */
40 margin: 3.4em 0 0 1.4em;
76 #menu li a:hover, #menu li a:active {
78 background: #FFF url(/static/img/arrow-down.png) no-repeat center right;
83 background: #FFF url(/static/img/arrow-up.png) no-repeat center right;
101 #toc, #themes, #nota_red {
108 border-bottom: 0.25em solid #DDD;
109 border-right: 0.25em solid #DDD;
118 #toc ol, #themes ol {
129 padding: 0 0 1.5em 1.5em;
149 /* =================================================== */
150 /* = Common elements: headings, paragraphs and lines = */
151 /* =================================================== */
184 /* ======================== */
185 /* = Footnotes and themes = */
186 /* ======================== */
188 border-left: 0.1em solid #DDDDDD;
195 font-variant: normal;
197 text-transform: none;
198 text-decoration: none;
202 margin-right: -9.5em;
203 margin-bottom: 0.5em;
219 #footnotes .annotation {
247 margin: -0.25em -0.5em;
253 padding: 0.25em 0.5em;
257 .anchor:hover, #book-text .anchor:active {
259 background-color: #CCC;
262 /* =================== */
263 /* = Custom elements = */
264 /* =================== */
269 margin-bottom: 0.25em;
276 margin-bottom: -0.25em;
288 margin: 0.5em 0 0 1.5em;
299 div.kwestia div.stanza {
320 border-bottom: 0.1em solid #999;
321 padding-bottom: 1.5em;
324 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
337 border-bottom: 0.1em solid #000;
348 padding: 0 0 0 1.5em;
355 em.math, em.foreign-word, em.book-title, em.didaskalia {
360 letter-spacing: 0.1em;
365 font-variant: small-caps;
373 /* =================================== */
374 /* = Hide some elements for printing = */
375 /* =================================== */
378 #menu {display: none;}
383 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
384 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
387 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
389 <a name="{concat('footnote-', generate-id(.))}" />
390 <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>
392 <xsl:when test="count(akap|akap_cd|strofa) = 0">
393 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
396 <xsl:apply-templates select="text()|*" mode="inline" />
409 <!-- ============================================================================== -->
410 <!-- = MASTER TAG = -->
411 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
412 <!-- ============================================================================== -->
413 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
414 <xsl:apply-templates select="nota_red" mode="special" />
415 <xsl:if test="nazwa_utworu">
417 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
420 <xsl:apply-templates />
424 <!-- ==================================================================================== -->
425 <!-- = BLOCK TAGS = -->
426 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
427 <!-- ==================================================================================== -->
428 <xsl:template match="nota">
429 <div class="note"><xsl:apply-templates /></div>
432 <xsl:template match="lista_osob">
433 <div class="person-list">
434 <h3><xsl:value-of select="naglowek_listy" /></h3>
436 <xsl:apply-templates select="lista_osoba" />
441 <xsl:template match="dedykacja">
442 <div class="dedication"><xsl:apply-templates /></div>
445 <xsl:template match="kwestia">
446 <div class="kwestia">
447 <xsl:apply-templates select="strofa|akap|didaskalia" />
451 <xsl:template match="dlugi_cytat|poezja_cyt">
452 <blockquote><xsl:apply-templates /></blockquote>
455 <xsl:template match="motto">
456 <div class="motto"><xsl:apply-templates mode="inline" /></div>
460 <!-- ========================================== -->
461 <!-- = PARAGRAPH TAGS = -->
462 <!-- = (can contain inline and special tags) = -->
463 <!-- ========================================== -->
465 <xsl:template match="autor_utworu" mode="header">
466 <span class="author"><xsl:apply-templates mode="inline" /></span>
469 <xsl:template match="nazwa_utworu" mode="header">
470 <span class="title"><xsl:apply-templates mode="inline" /></span>
473 <xsl:template match="dzielo_nadrzedne" mode="header">
474 <span class="collection"><xsl:apply-templates mode="inline" /></span>
477 <xsl:template match="podtytul" mode="header">
478 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
481 <!-- Section headers (included in index)-->
482 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
483 <h2><xsl:apply-templates mode="inline" /></h2>
486 <xsl:template match="naglowek_scena|naglowek_rozdzial">
487 <h3><xsl:apply-templates mode="inline" /></h3>
490 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
491 <h4><xsl:apply-templates mode="inline" /></h4>
494 <!-- Other paragraph tags -->
495 <xsl:template match="miejsce_czas">
496 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
499 <xsl:template match="didaskalia">
500 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
503 <xsl:template match="lista_osoba">
504 <li><xsl:apply-templates mode="inline" /></li>
507 <xsl:template match="akap|akap_dialog|akap_cd">
508 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
511 <xsl:template match="strofa">
514 <xsl:when test="count(br) > 0">
515 <xsl:call-template name="verse">
516 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
517 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
519 <xsl:for-each select="br">
520 <!-- Each BR tag "consumes" text after it -->
521 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
522 <xsl:call-template name="verse">
523 <xsl:with-param name="verse-content"
524 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
525 <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]" />
530 <xsl:call-template name="verse">
531 <xsl:with-param name="verse-content" select="text() | node()" />
532 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
539 <xsl:template name="verse">
540 <xsl:param name="verse-content" />
541 <xsl:param name="verse-type" />
544 <xsl:when test="name($verse-type) = 'wers_akap'">
545 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
547 <xsl:when test="name($verse-type) = 'wers_wciety'">
549 <xsl:when test="$verse-content/@typ">
550 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
553 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
557 <xsl:when test="name($verse-type) = 'wers_cd'">
558 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
561 <xsl:apply-templates select="$verse-content" mode="inline" />
565 <xsl:template match="motto_podpis">
566 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
570 <!-- ================================================ -->
571 <!-- = INLINE TAGS = -->
572 <!-- = (contain other inline tags and special tags) = -->
573 <!-- ================================================ -->
575 <xsl:template match="pa|pe|pr|pt" mode="inline">
576 <a name="{concat('anchor-', generate-id(.))}" />
577 <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>
580 <!-- Other inline tags -->
581 <xsl:template match="mat" mode="inline">
582 <em class="math"><xsl:apply-templates mode="inline" /></em>
585 <xsl:template match="didask_tekst" mode="inline">
586 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
589 <xsl:template match="slowo_obce" mode="inline">
590 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
593 <xsl:template match="tytul_dziela" mode="inline">
594 <em class="book-title">
595 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
599 <xsl:template match="wyroznienie" mode="inline">
600 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
603 <xsl:template match="osoba" mode="inline">
604 <em class="person"><xsl:apply-templates mode="inline" /></em>
608 <!-- ============================================== -->
609 <!-- = STANDALONE TAGS = -->
610 <!-- = (cannot contain any other tags) = -->
611 <!-- ============================================== -->
612 <xsl:template match="sekcja_swiatlo">
613 <hr class="spacer" />
616 <xsl:template match="sekcja_asterysk">
617 <p class="spacer-asterisk">*</p>
620 <xsl:template match="separator_linia">
621 <hr class="spacer-line" />
625 <!-- ================ -->
626 <!-- = SPECIAL TAGS = -->
627 <!-- ================ -->
629 <xsl:template match="begin" mode="inline">
630 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
631 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
632 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
636 <xsl:template match="end" mode="inline">
637 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
640 <xsl:template match="begin|end">
641 <xsl:apply-templates select='.' mode="inline" />
644 <xsl:template match="motyw" mode="inline" />
647 <xsl:template match="nota_red" mode="special">
649 <xsl:apply-templates />
654 <!-- ================ -->
655 <!-- = IGNORED TAGS = -->
656 <!-- ================ -->
657 <xsl:template match="extra|uwaga" />
658 <xsl:template match="extra|uwaga" mode="inline" />
660 <xsl:template match="nota_red" />
665 <xsl:template match="text()" />
666 <xsl:template match="text()" mode="inline">
667 <xsl:value-of select="wl:substitute_entities(.)" />