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" />
420 <xsl:if test="name()='pa'"> [przypis autorski]</xsl:if>
424 <xsl:apply-templates select="text()|*" mode="inline" />
435 <!-- ============================================================================== -->
436 <!-- = MASTER TAG = -->
437 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
438 <!-- ============================================================================== -->
439 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
440 <xsl:apply-templates select="nota_red" mode="special" />
441 <xsl:if test="nazwa_utworu">
443 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
444 <xsl:call-template name="translators" />
447 <xsl:apply-templates />
451 <!-- ==================================================================================== -->
452 <!-- = BLOCK TAGS = -->
453 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
454 <!-- ==================================================================================== -->
455 <xsl:template match="nota">
456 <div class="note"><xsl:apply-templates /></div>
459 <xsl:template match="lista_osob">
460 <div class="person-list">
461 <h3><xsl:value-of select="naglowek_listy" /></h3>
463 <xsl:apply-templates select="lista_osoba" />
468 <xsl:template match="dedykacja">
469 <div class="dedication"><xsl:apply-templates /></div>
472 <xsl:template match="kwestia">
473 <div class="kwestia">
474 <xsl:apply-templates select="strofa|akap|didaskalia" />
478 <xsl:template match="dlugi_cytat|poezja_cyt">
479 <blockquote><xsl:apply-templates /></blockquote>
482 <xsl:template match="motto">
483 <div class="motto"><xsl:apply-templates mode="inline" /></div>
487 <!-- ========================================== -->
488 <!-- = PARAGRAPH TAGS = -->
489 <!-- = (can contain inline and special tags) = -->
490 <!-- ========================================== -->
492 <xsl:template match="autor_utworu" mode="header">
493 <span class="author"><xsl:apply-templates mode="inline" /></span>
496 <xsl:template match="nazwa_utworu" mode="header">
497 <span class="title"><xsl:apply-templates mode="inline" /></span>
500 <xsl:template match="dzielo_nadrzedne" mode="header">
501 <span class="collection"><xsl:apply-templates mode="inline" /></span>
504 <xsl:template match="podtytul" mode="header">
505 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
508 <!-- Section headers (included in index)-->
509 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
510 <h2><xsl:apply-templates mode="inline" /></h2>
513 <xsl:template match="naglowek_scena|naglowek_rozdzial">
514 <h3><xsl:apply-templates mode="inline" /></h3>
517 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
518 <h4><xsl:apply-templates mode="inline" /></h4>
521 <!-- Other paragraph tags -->
522 <xsl:template match="miejsce_czas">
523 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
526 <xsl:template match="didaskalia">
527 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
530 <xsl:template match="lista_osoba">
531 <li><xsl:apply-templates mode="inline" /></li>
534 <xsl:template match="akap|akap_dialog|akap_cd">
535 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
538 <xsl:template match="strofa">
541 <xsl:when test="count(br) > 0">
542 <xsl:call-template name="verse">
543 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
544 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
546 <xsl:for-each select="br">
547 <!-- Each BR tag "consumes" text after it -->
548 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
549 <xsl:call-template name="verse">
550 <xsl:with-param name="verse-content"
551 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
552 <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]" />
557 <xsl:call-template name="verse">
558 <xsl:with-param name="verse-content" select="text() | node()" />
559 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
566 <xsl:template name="verse">
567 <xsl:param name="verse-content" />
568 <xsl:param name="verse-type" />
571 <xsl:when test="name($verse-type) = 'wers_akap'">
572 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
574 <xsl:when test="name($verse-type) = 'wers_wciety'">
576 <xsl:when test="$verse-content/@typ">
577 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
580 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
584 <xsl:when test="name($verse-type) = 'wers_cd'">
585 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
588 <xsl:apply-templates select="$verse-content" mode="inline" />
592 <xsl:template match="motto_podpis">
593 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
597 <!-- ================================================ -->
598 <!-- = INLINE TAGS = -->
599 <!-- = (contain other inline tags and special tags) = -->
600 <!-- ================================================ -->
602 <xsl:template match="pa|pe|pr|pt" mode="inline">
603 <a name="{concat('anchor-', generate-id(.))}" />
604 <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>
607 <!-- Other inline tags -->
608 <xsl:template match="mat" mode="inline">
609 <em class="math"><xsl:apply-templates mode="inline" /></em>
612 <xsl:template match="didask_tekst" mode="inline">
613 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
616 <xsl:template match="slowo_obce" mode="inline">
617 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
620 <xsl:template match="tytul_dziela" mode="inline">
621 <em class="book-title">
622 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
626 <xsl:template match="wyroznienie" mode="inline">
627 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
630 <xsl:template match="osoba" mode="inline">
631 <em class="person"><xsl:apply-templates mode="inline" /></em>
635 <!-- ============================================== -->
636 <!-- = STANDALONE TAGS = -->
637 <!-- = (cannot contain any other tags) = -->
638 <!-- ============================================== -->
639 <xsl:template match="sekcja_swiatlo">
640 <hr class="spacer" />
643 <xsl:template match="sekcja_asterysk">
644 <p class="spacer-asterisk">*</p>
647 <xsl:template match="separator_linia">
648 <hr class="spacer-line" />
652 <!-- ================ -->
653 <!-- = SPECIAL TAGS = -->
654 <!-- ================ -->
656 <xsl:template match="begin" mode="inline">
657 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
658 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
659 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
663 <xsl:template match="end" mode="inline">
664 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
667 <xsl:template match="begin|end">
668 <xsl:apply-templates select='.' mode="inline" />
671 <xsl:template match="motyw" mode="inline" />
674 <xsl:template match="nota_red" mode="special">
676 <xsl:apply-templates />
681 <xsl:template name="translators">
682 <xsl:if test="//dc:contributor.translator">
683 <span class="translator">
684 <xsl:text>tłum. </xsl:text>
685 <xsl:for-each select="//dc:contributor.translator">
686 <xsl:if test="position() != 1">, </xsl:if>
687 <xsl:apply-templates mode="person" />
693 <xsl:template match="text()" mode="person">
694 <xsl:value-of select="wl:person_name(.)" />
698 <!-- ================ -->
699 <!-- = IGNORED TAGS = -->
700 <!-- ================ -->
701 <xsl:template match="extra|uwaga" />
702 <xsl:template match="extra|uwaga" mode="inline" />
704 <xsl:template match="nota_red" />
709 <xsl:template match="text()" />
710 <xsl:template match="text()" mode="inline">
711 <xsl:value-of select="wl:substitute_entities(.)" />