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><xsl:apply-templates mode="inline" select="//nazwa_utworu" /></title>
20 <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;
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;}
399 <xsl:call-template name="book-text" />
404 <xsl:call-template name="book-text" />
409 <xsl:template name="book-text">
411 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
412 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
415 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
417 <a name="{concat('footnote-', generate-id(.))}" />
418 <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>
420 <xsl:when test="count(akap|akap_cd|strofa) = 0">
421 <p><xsl:apply-templates select="text()|*" mode="inline" />
422 <xsl:if test="name()='pa'"> [przypis autorski]</xsl:if>
426 <xsl:apply-templates select="text()|*" mode="inline" />
437 <!-- ============================================================================== -->
438 <!-- = MASTER TAG = -->
439 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
440 <!-- ============================================================================== -->
441 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
442 <xsl:apply-templates select="nota_red" mode="special" />
443 <xsl:if test="nazwa_utworu">
445 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
446 <xsl:call-template name="translators" />
449 <xsl:apply-templates />
453 <!-- ==================================================================================== -->
454 <!-- = BLOCK TAGS = -->
455 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
456 <!-- ==================================================================================== -->
457 <xsl:template match="nota">
458 <div class="note"><xsl:apply-templates /></div>
461 <xsl:template match="lista_osob">
462 <div class="person-list">
463 <h3><xsl:value-of select="naglowek_listy" /></h3>
465 <xsl:apply-templates select="lista_osoba" />
470 <xsl:template match="dedykacja">
471 <div class="dedication"><xsl:apply-templates /></div>
474 <xsl:template match="kwestia">
475 <div class="kwestia">
476 <xsl:apply-templates select="strofa|akap|didaskalia" />
480 <xsl:template match="dlugi_cytat|poezja_cyt">
481 <blockquote><xsl:apply-templates /></blockquote>
484 <xsl:template match="motto">
485 <div class="motto"><xsl:apply-templates mode="inline" /></div>
489 <!-- ========================================== -->
490 <!-- = PARAGRAPH TAGS = -->
491 <!-- = (can contain inline and special tags) = -->
492 <!-- ========================================== -->
494 <xsl:template match="autor_utworu" mode="header">
495 <span class="author"><xsl:apply-templates mode="inline" /></span>
498 <xsl:template match="nazwa_utworu" mode="header">
499 <span class="title"><xsl:apply-templates mode="inline" /></span>
502 <xsl:template match="dzielo_nadrzedne" mode="header">
503 <span class="collection"><xsl:apply-templates mode="inline" /></span>
506 <xsl:template match="podtytul" mode="header">
507 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
510 <!-- Section headers (included in index)-->
511 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
512 <xsl:call-template name="section-anchor"/>
513 <h2><xsl:apply-templates mode="inline" /></h2>
516 <xsl:template match="naglowek_scena|naglowek_rozdzial">
517 <xsl:call-template name="section-anchor"/>
518 <h3><xsl:apply-templates mode="inline" /></h3>
521 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
522 <xsl:call-template name="section-anchor"/>
523 <h4><xsl:apply-templates mode="inline" /></h4>
526 <!-- Other paragraph tags -->
527 <xsl:template match="miejsce_czas">
528 <xsl:call-template name="section-anchor"/>
529 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
532 <xsl:template match="didaskalia">
533 <xsl:call-template name="section-anchor"/>
534 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
537 <xsl:template match="lista_osoba">
538 <li><xsl:apply-templates mode="inline" /></li>
541 <xsl:template match="akap|akap_dialog|akap_cd">
542 <p class="paragraph">
543 <xsl:call-template name="section-anchor"/>
544 <xsl:apply-templates mode="inline" />
548 <xsl:template match="strofa">
550 <xsl:call-template name="section-anchor"/>
552 <xsl:when test="count(br) > 0">
553 <xsl:call-template name="verse">
554 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
555 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
557 <xsl:for-each select="br">
558 <!-- Each BR tag "consumes" text after it -->
559 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
560 <xsl:call-template name="verse">
561 <xsl:with-param name="verse-content"
562 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
563 <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]" />
568 <xsl:call-template name="verse">
569 <xsl:with-param name="verse-content" select="text() | node()" />
570 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
577 <xsl:template name="verse">
578 <xsl:param name="verse-content" />
579 <xsl:param name="verse-type" />
582 <xsl:when test="name($verse-type) = 'wers_akap'">
583 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
585 <xsl:when test="name($verse-type) = 'wers_wciety'">
587 <xsl:when test="$verse-content/@typ">
588 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
591 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
595 <xsl:when test="name($verse-type) = 'wers_cd'">
596 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
599 <xsl:apply-templates select="$verse-content" mode="inline" />
603 <xsl:template match="motto_podpis">
604 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
608 <!-- ================================================ -->
609 <!-- = INLINE TAGS = -->
610 <!-- = (contain other inline tags and special tags) = -->
611 <!-- ================================================ -->
613 <xsl:template match="pa|pe|pr|pt" mode="inline">
614 <a name="{concat('anchor-', generate-id(.))}" />
615 <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>
618 <!-- Other inline tags -->
619 <xsl:template match="mat" mode="inline">
620 <em class="math"><xsl:apply-templates mode="inline" /></em>
623 <xsl:template match="didask_tekst" mode="inline">
624 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
627 <xsl:template match="slowo_obce" mode="inline">
628 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
631 <xsl:template match="tytul_dziela" mode="inline">
632 <em class="book-title">
633 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
637 <xsl:template match="wyroznienie" mode="inline">
638 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
641 <xsl:template match="osoba" mode="inline">
642 <em class="person"><xsl:apply-templates mode="inline" /></em>
646 <!-- ============================================== -->
647 <!-- = STANDALONE TAGS = -->
648 <!-- = (cannot contain any other tags) = -->
649 <!-- ============================================== -->
650 <xsl:template match="sekcja_swiatlo">
651 <hr class="spacer" />
654 <xsl:template match="sekcja_asterysk">
655 <p class="spacer-asterisk">*</p>
658 <xsl:template match="separator_linia">
659 <hr class="spacer-line" />
662 <xsl:template match="ilustr">
663 <div xmlns="http://www.w3.org/1999/xhtml" class="ilustr">
664 <img xmlns="http://www.w3.org/1999/xhtml" alt="ilustracja">
665 <xsl:attribute name="src">
666 <xsl:value-of select="@src" />
668 <xsl:attribute name="alt">
669 <xsl:apply-templates mode="inline" />
671 <xsl:attribute name="title">
672 <xsl:apply-templates mode="inline" />
679 <!-- ================ -->
680 <!-- = SPECIAL TAGS = -->
681 <!-- ================ -->
683 <xsl:template match="begin" mode="inline">
684 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
685 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
686 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
690 <xsl:template match="end" mode="inline">
691 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
694 <xsl:template match="begin|end">
695 <xsl:apply-templates select='.' mode="inline" />
698 <xsl:template match="motyw" mode="inline" />
701 <xsl:template match="nota_red" mode="special">
703 <xsl:apply-templates />
708 <xsl:template name="translators">
709 <xsl:if test="//dc:contributor.translator">
710 <span class="translator">
711 <xsl:text>tłum. </xsl:text>
712 <xsl:for-each select="//dc:contributor.translator">
713 <xsl:if test="position() != 1">, </xsl:if>
714 <xsl:apply-templates mode="person" />
720 <xsl:template match="text()" mode="person">
721 <xsl:value-of select="wl:person_name(.)" />
725 <!-- ================ -->
726 <!-- = IGNORED TAGS = -->
727 <!-- ================ -->
728 <xsl:template match="extra|uwaga" />
729 <xsl:template match="extra|uwaga" mode="inline" />
731 <xsl:template match="nota_red" />
736 <xsl:template match="text()" />
737 <xsl:template match="text()" mode="inline">
738 <xsl:value-of select="wl:substitute_entities(.)" />
744 <xsl:template name="section-anchor">
746 this formula works as follows:
747 - get all ancestors including self
748 - choose the header (third one from root): utwor/book-type/header
749 - get all preceding siblings
751 - create an <a name="sec123"/> tag.
753 <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />