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"
10 xmlns:dc="http://purl.org/dc/elements/1.1/" >
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">
16 <xsl:when test="@full-page">
19 <title>Książka z serwisu WolneLektury.pl</title>
20 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
25 font: Georgia, "Times New Roman", serif;
32 text-decoration: none;
40 /* ================================== */
41 /* = Header with logo and menu = */
42 /* ================================== */
44 margin: 3.4em 0 0 1.4em;
80 #menu li a:hover, #menu li a:active {
82 background: #FFF url(/static/img/arrow-down.png) no-repeat center right;
87 background: #FFF url(/static/img/arrow-up.png) no-repeat center right;
105 #toc, #themes, #nota_red, #info {
112 border-bottom: 0.25em solid #DDD;
113 border-right: 0.25em solid #DDD;
122 #toc ol, #themes ol {
133 padding: 0 0 1.5em 1.5em;
158 /* =================================================== */
159 /* = Common elements: headings, paragraphs and lines = */
160 /* =================================================== */
193 /* ======================== */
194 /* = Footnotes and themes = */
195 /* ======================== */
197 border-left: 0.1em solid #DDDDDD;
204 font-variant: normal;
206 text-transform: none;
207 text-decoration: none;
211 margin-right: -9.5em;
212 margin-bottom: 0.5em;
228 #footnotes .annotation {
256 margin: -0.25em -0.5em;
262 padding: 0.25em 0.5em;
266 .anchor:hover, #book-text .anchor:active {
268 background-color: #CCC;
271 /* =================== */
272 /* = Custom elements = */
273 /* =================== */
278 margin-bottom: 0.25em;
285 margin-bottom: -0.25em;
304 margin: 0.5em 0 0 1.5em;
315 div.kwestia div.stanza {
336 border-bottom: 0.1em solid #999;
337 padding-bottom: 1.5em;
340 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
353 border-bottom: 0.1em solid #000;
364 padding: 0 0 0 1.5em;
371 em.math, em.foreign-word, em.book-title, em.didaskalia {
376 letter-spacing: 0.1em;
381 font-variant: small-caps;
389 /* =================================== */
390 /* = Hide some elements for printing = */
391 /* =================================== */
394 #menu {display: none;}
398 <xsl:call-template name="book-text" />
403 <xsl:call-template name="book-text" />
408 <xsl:template name="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)])">
414 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
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>
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>
425 <xsl:apply-templates select="text()|*" mode="inline" />
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">
444 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
445 <xsl:call-template name="translators" />
448 <xsl:apply-templates />
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>
460 <xsl:template match="lista_osob">
461 <div class="person-list">
462 <h3><xsl:value-of select="naglowek_listy" /></h3>
464 <xsl:apply-templates select="lista_osoba" />
469 <xsl:template match="dedykacja">
470 <div class="dedication"><xsl:apply-templates /></div>
473 <xsl:template match="kwestia">
474 <div class="kwestia">
475 <xsl:apply-templates select="strofa|akap|didaskalia" />
479 <xsl:template match="dlugi_cytat|poezja_cyt">
480 <blockquote><xsl:apply-templates /></blockquote>
483 <xsl:template match="motto">
484 <div class="motto"><xsl:apply-templates mode="inline" /></div>
488 <!-- ========================================== -->
489 <!-- = PARAGRAPH TAGS = -->
490 <!-- = (can contain inline and special tags) = -->
491 <!-- ========================================== -->
493 <xsl:template match="autor_utworu" mode="header">
494 <span class="author"><xsl:apply-templates mode="inline" /></span>
497 <xsl:template match="nazwa_utworu" mode="header">
498 <span class="title"><xsl:apply-templates mode="inline" /></span>
501 <xsl:template match="dzielo_nadrzedne" mode="header">
502 <span class="collection"><xsl:apply-templates mode="inline" /></span>
505 <xsl:template match="podtytul" mode="header">
506 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
509 <!-- Section headers (included in index)-->
510 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
511 <h2><xsl:apply-templates mode="inline" /></h2>
514 <xsl:template match="naglowek_scena|naglowek_rozdzial">
515 <h3><xsl:apply-templates mode="inline" /></h3>
518 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
519 <h4><xsl:apply-templates mode="inline" /></h4>
522 <!-- Other paragraph tags -->
523 <xsl:template match="miejsce_czas">
524 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
527 <xsl:template match="didaskalia">
528 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
531 <xsl:template match="lista_osoba">
532 <li><xsl:apply-templates mode="inline" /></li>
535 <xsl:template match="akap|akap_dialog|akap_cd">
536 <p class="paragraph">
537 <a name="{concat('sect', position())}" />
538 <xsl:apply-templates mode="inline" />
542 <xsl:template match="strofa">
544 <a name="{concat('sect', position())}" />
546 <xsl:when test="count(br) > 0">
547 <xsl:call-template name="verse">
548 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
549 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
551 <xsl:for-each select="br">
552 <!-- Each BR tag "consumes" text after it -->
553 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
554 <xsl:call-template name="verse">
555 <xsl:with-param name="verse-content"
556 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
557 <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]" />
562 <xsl:call-template name="verse">
563 <xsl:with-param name="verse-content" select="text() | node()" />
564 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
571 <xsl:template name="verse">
572 <xsl:param name="verse-content" />
573 <xsl:param name="verse-type" />
576 <xsl:when test="name($verse-type) = 'wers_akap'">
577 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
579 <xsl:when test="name($verse-type) = 'wers_wciety'">
581 <xsl:when test="$verse-content/@typ">
582 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
585 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
589 <xsl:when test="name($verse-type) = 'wers_cd'">
590 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
593 <xsl:apply-templates select="$verse-content" mode="inline" />
597 <xsl:template match="motto_podpis">
598 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
602 <!-- ================================================ -->
603 <!-- = INLINE TAGS = -->
604 <!-- = (contain other inline tags and special tags) = -->
605 <!-- ================================================ -->
607 <xsl:template match="pa|pe|pr|pt" mode="inline">
608 <a name="{concat('anchor-', generate-id(.))}" />
609 <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>
612 <!-- Other inline tags -->
613 <xsl:template match="mat" mode="inline">
614 <em class="math"><xsl:apply-templates mode="inline" /></em>
617 <xsl:template match="didask_tekst" mode="inline">
618 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
621 <xsl:template match="slowo_obce" mode="inline">
622 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
625 <xsl:template match="tytul_dziela" mode="inline">
626 <em class="book-title">
627 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
631 <xsl:template match="wyroznienie" mode="inline">
632 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
635 <xsl:template match="osoba" mode="inline">
636 <em class="person"><xsl:apply-templates mode="inline" /></em>
640 <!-- ============================================== -->
641 <!-- = STANDALONE TAGS = -->
642 <!-- = (cannot contain any other tags) = -->
643 <!-- ============================================== -->
644 <xsl:template match="sekcja_swiatlo">
645 <hr class="spacer" />
648 <xsl:template match="sekcja_asterysk">
649 <p class="spacer-asterisk">*</p>
652 <xsl:template match="separator_linia">
653 <hr class="spacer-line" />
657 <!-- ================ -->
658 <!-- = SPECIAL TAGS = -->
659 <!-- ================ -->
661 <xsl:template match="begin" mode="inline">
662 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
663 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
664 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
668 <xsl:template match="end" mode="inline">
669 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
672 <xsl:template match="begin|end">
673 <xsl:apply-templates select='.' mode="inline" />
676 <xsl:template match="motyw" mode="inline" />
679 <xsl:template match="nota_red" mode="special">
681 <xsl:apply-templates />
686 <xsl:template name="translators">
687 <xsl:if test="//dc:contributor.translator">
688 <span class="translator">
689 <xsl:text>tłum. </xsl:text>
690 <xsl:for-each select="//dc:contributor.translator">
691 <xsl:if test="position() != 1">, </xsl:if>
692 <xsl:apply-templates mode="person" />
698 <xsl:template match="text()" mode="person">
699 <xsl:value-of select="wl:person_name(.)" />
703 <!-- ================ -->
704 <!-- = IGNORED TAGS = -->
705 <!-- ================ -->
706 <xsl:template match="extra|uwaga" />
707 <xsl:template match="extra|uwaga" mode="inline" />
709 <xsl:template match="nota_red" />
714 <xsl:template match="text()" />
715 <xsl:template match="text()" mode="inline">
716 <xsl:value-of select="wl:substitute_entities(.)" />