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:template match="utwor">
15 <xsl:when test="@full-page">
18 <title>Książka z serwisu WolneLektury.pl</title>
19 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
24 font: Georgia, "Times New Roman", serif;
31 text-decoration: none;
39 /* ================================== */
40 /* = Header with logo and menu = */
41 /* ================================== */
43 margin: 3.4em 0 0 1.4em;
79 #menu li a:hover, #menu li a:active {
81 background: #FFF url(/static/img/arrow-down.png) no-repeat center right;
86 background: #FFF url(/static/img/arrow-up.png) no-repeat center right;
104 #toc, #themes, #nota_red, #info {
111 border-bottom: 0.25em solid #DDD;
112 border-right: 0.25em solid #DDD;
121 #toc ol, #themes ol {
132 padding: 0 0 1.5em 1.5em;
157 /* =================================================== */
158 /* = Common elements: headings, paragraphs and lines = */
159 /* =================================================== */
192 /* ======================== */
193 /* = Footnotes and themes = */
194 /* ======================== */
196 border-left: 0.1em solid #DDDDDD;
203 font-variant: normal;
205 text-transform: none;
206 text-decoration: none;
210 margin-right: -9.5em;
211 margin-bottom: 0.5em;
227 #footnotes .annotation {
255 margin: -0.25em -0.5em;
261 padding: 0.25em 0.5em;
265 .anchor:hover, #book-text .anchor:active {
267 background-color: #CCC;
270 /* =================== */
271 /* = Custom elements = */
272 /* =================== */
277 margin-bottom: 0.25em;
284 margin-bottom: -0.25em;
303 margin: 0.5em 0 0 1.5em;
314 div.kwestia div.stanza {
335 border-bottom: 0.1em solid #999;
336 padding-bottom: 1.5em;
339 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
352 border-bottom: 0.1em solid #000;
363 padding: 0 0 0 1.5em;
370 em.math, em.foreign-word, em.book-title, em.didaskalia {
375 letter-spacing: 0.1em;
380 font-variant: small-caps;
388 /* =================================== */
389 /* = Hide some elements for printing = */
390 /* =================================== */
393 #menu {display: none;}
397 <xsl:call-template name="book-text" />
402 <xsl:call-template name="book-text" />
407 <xsl:template name="book-text">
409 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
410 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
413 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
415 <a name="{concat('footnote-', generate-id(.))}" />
416 <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:when test="count(akap|akap_cd|strofa) = 0">
419 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
422 <xsl:apply-templates select="text()|*" mode="inline" />
433 <!-- ============================================================================== -->
434 <!-- = MASTER TAG = -->
435 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
436 <!-- ============================================================================== -->
437 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
438 <xsl:apply-templates select="nota_red" mode="special" />
439 <xsl:if test="nazwa_utworu">
441 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
442 <xsl:call-template name="translators" />
445 <xsl:apply-templates />
449 <!-- ==================================================================================== -->
450 <!-- = BLOCK TAGS = -->
451 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
452 <!-- ==================================================================================== -->
453 <xsl:template match="nota">
454 <div class="note"><xsl:apply-templates /></div>
457 <xsl:template match="lista_osob">
458 <div class="person-list">
459 <h3><xsl:value-of select="naglowek_listy" /></h3>
461 <xsl:apply-templates select="lista_osoba" />
466 <xsl:template match="dedykacja">
467 <div class="dedication"><xsl:apply-templates /></div>
470 <xsl:template match="kwestia">
471 <div class="kwestia">
472 <xsl:apply-templates select="strofa|akap|didaskalia" />
476 <xsl:template match="dlugi_cytat|poezja_cyt">
477 <blockquote><xsl:apply-templates /></blockquote>
480 <xsl:template match="motto">
481 <div class="motto"><xsl:apply-templates mode="inline" /></div>
485 <!-- ========================================== -->
486 <!-- = PARAGRAPH TAGS = -->
487 <!-- = (can contain inline and special tags) = -->
488 <!-- ========================================== -->
490 <xsl:template match="autor_utworu" mode="header">
491 <span class="author"><xsl:apply-templates mode="inline" /></span>
494 <xsl:template match="nazwa_utworu" mode="header">
495 <span class="title"><xsl:apply-templates mode="inline" /></span>
498 <xsl:template match="dzielo_nadrzedne" mode="header">
499 <span class="collection"><xsl:apply-templates mode="inline" /></span>
502 <xsl:template match="podtytul" mode="header">
503 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
506 <!-- Section headers (included in index)-->
507 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
508 <h2><xsl:apply-templates mode="inline" /></h2>
511 <xsl:template match="naglowek_scena|naglowek_rozdzial">
512 <h3><xsl:apply-templates mode="inline" /></h3>
515 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
516 <h4><xsl:apply-templates mode="inline" /></h4>
519 <!-- Other paragraph tags -->
520 <xsl:template match="miejsce_czas">
521 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
524 <xsl:template match="didaskalia">
525 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
528 <xsl:template match="lista_osoba">
529 <li><xsl:apply-templates mode="inline" /></li>
532 <xsl:template match="akap|akap_dialog|akap_cd">
533 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
536 <xsl:template match="strofa">
539 <xsl:when test="count(br) > 0">
540 <xsl:call-template name="verse">
541 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
542 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
544 <xsl:for-each select="br">
545 <!-- Each BR tag "consumes" text after it -->
546 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
547 <xsl:call-template name="verse">
548 <xsl:with-param name="verse-content"
549 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
550 <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]" />
555 <xsl:call-template name="verse">
556 <xsl:with-param name="verse-content" select="text() | node()" />
557 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
564 <xsl:template name="verse">
565 <xsl:param name="verse-content" />
566 <xsl:param name="verse-type" />
569 <xsl:when test="name($verse-type) = 'wers_akap'">
570 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
572 <xsl:when test="name($verse-type) = 'wers_wciety'">
574 <xsl:when test="$verse-content/@typ">
575 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
578 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
582 <xsl:when test="name($verse-type) = 'wers_cd'">
583 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
586 <xsl:apply-templates select="$verse-content" mode="inline" />
590 <xsl:template match="motto_podpis">
591 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
595 <!-- ================================================ -->
596 <!-- = INLINE TAGS = -->
597 <!-- = (contain other inline tags and special tags) = -->
598 <!-- ================================================ -->
600 <xsl:template match="pa|pe|pr|pt" mode="inline">
601 <a name="{concat('anchor-', generate-id(.))}" />
602 <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>
605 <!-- Other inline tags -->
606 <xsl:template match="mat" mode="inline">
607 <em class="math"><xsl:apply-templates mode="inline" /></em>
610 <xsl:template match="didask_tekst" mode="inline">
611 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
614 <xsl:template match="slowo_obce" mode="inline">
615 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
618 <xsl:template match="tytul_dziela" mode="inline">
619 <em class="book-title">
620 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
624 <xsl:template match="wyroznienie" mode="inline">
625 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
628 <xsl:template match="osoba" mode="inline">
629 <em class="person"><xsl:apply-templates mode="inline" /></em>
633 <!-- ============================================== -->
634 <!-- = STANDALONE TAGS = -->
635 <!-- = (cannot contain any other tags) = -->
636 <!-- ============================================== -->
637 <xsl:template match="sekcja_swiatlo">
638 <hr class="spacer" />
641 <xsl:template match="sekcja_asterysk">
642 <p class="spacer-asterisk">*</p>
645 <xsl:template match="separator_linia">
646 <hr class="spacer-line" />
650 <!-- ================ -->
651 <!-- = SPECIAL TAGS = -->
652 <!-- ================ -->
654 <xsl:template match="begin" mode="inline">
655 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
656 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
657 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
661 <xsl:template match="end" mode="inline">
662 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
665 <xsl:template match="begin|end">
666 <xsl:apply-templates select='.' mode="inline" />
669 <xsl:template match="motyw" mode="inline" />
672 <xsl:template match="nota_red" mode="special">
674 <xsl:apply-templates />
679 <xsl:template name="translators">
680 <xsl:if test="//dc:contributor.translator">
681 <span class="translator">
682 <xsl:text>tłum. </xsl:text>
683 <xsl:for-each select="//dc:contributor.translator">
684 <xsl:if test="position() != 1">, </xsl:if>
685 <xsl:apply-templates mode="person" />
691 <xsl:template match="text()" mode="person">
692 <xsl:value-of select="wl:person_name(.)" />
696 <!-- ================ -->
697 <!-- = IGNORED TAGS = -->
698 <!-- ================ -->
699 <xsl:template match="extra|uwaga" />
700 <xsl:template match="extra|uwaga" mode="inline" />
702 <xsl:template match="nota_red" />
707 <xsl:template match="text()" />
708 <xsl:template match="text()" mode="inline">
709 <xsl:value-of select="wl:substitute_entities(.)" />