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">
14 <xsl:when test="@full-page">
17 <title>Książka z serwisu WolneLektury.pl</title>
18 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
23 font: Georgia, "Times New Roman", serif;
30 text-decoration: none;
38 /* ================================== */
39 /* = Header with logo and menu = */
40 /* ================================== */
42 margin: 3.4em 0 0 1.4em;
78 #menu li a:hover, #menu li a:active {
80 background: #FFF url(/static/img/arrow-down.png) no-repeat center right;
85 background: #FFF url(/static/img/arrow-up.png) no-repeat center right;
103 #toc, #themes, #nota_red {
110 border-bottom: 0.25em solid #DDD;
111 border-right: 0.25em solid #DDD;
120 #toc ol, #themes ol {
131 padding: 0 0 1.5em 1.5em;
151 /* =================================================== */
152 /* = Common elements: headings, paragraphs and lines = */
153 /* =================================================== */
186 /* ======================== */
187 /* = Footnotes and themes = */
188 /* ======================== */
190 border-left: 0.1em solid #DDDDDD;
197 font-variant: normal;
199 text-transform: none;
200 text-decoration: none;
204 margin-right: -9.5em;
205 margin-bottom: 0.5em;
221 #footnotes .annotation {
249 margin: -0.25em -0.5em;
255 padding: 0.25em 0.5em;
259 .anchor:hover, #book-text .anchor:active {
261 background-color: #CCC;
264 /* =================== */
265 /* = Custom elements = */
266 /* =================== */
271 margin-bottom: 0.25em;
278 margin-bottom: -0.25em;
290 margin: 0.5em 0 0 1.5em;
301 div.kwestia div.stanza {
322 border-bottom: 0.1em solid #999;
323 padding-bottom: 1.5em;
326 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
339 border-bottom: 0.1em solid #000;
350 padding: 0 0 0 1.5em;
357 em.math, em.foreign-word, em.book-title, em.didaskalia {
362 letter-spacing: 0.1em;
367 font-variant: small-caps;
375 /* =================================== */
376 /* = Hide some elements for printing = */
377 /* =================================== */
380 #menu {display: none;}
384 <xsl:call-template name="book-text" />
389 <xsl:call-template name="book-text" />
394 <xsl:template name="book-text">
396 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
397 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
400 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
402 <a name="{concat('footnote-', generate-id(.))}" />
403 <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>
405 <xsl:when test="count(akap|akap_cd|strofa) = 0">
406 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
409 <xsl:apply-templates select="text()|*" mode="inline" />
420 <!-- ============================================================================== -->
421 <!-- = MASTER TAG = -->
422 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
423 <!-- ============================================================================== -->
424 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
425 <xsl:apply-templates select="nota_red" mode="special" />
426 <xsl:if test="nazwa_utworu">
428 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
431 <xsl:apply-templates />
435 <!-- ==================================================================================== -->
436 <!-- = BLOCK TAGS = -->
437 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
438 <!-- ==================================================================================== -->
439 <xsl:template match="nota">
440 <div class="note"><xsl:apply-templates /></div>
443 <xsl:template match="lista_osob">
444 <div class="person-list">
445 <h3><xsl:value-of select="naglowek_listy" /></h3>
447 <xsl:apply-templates select="lista_osoba" />
452 <xsl:template match="dedykacja">
453 <div class="dedication"><xsl:apply-templates /></div>
456 <xsl:template match="kwestia">
457 <div class="kwestia">
458 <xsl:apply-templates select="strofa|akap|didaskalia" />
462 <xsl:template match="dlugi_cytat|poezja_cyt">
463 <blockquote><xsl:apply-templates /></blockquote>
466 <xsl:template match="motto">
467 <div class="motto"><xsl:apply-templates mode="inline" /></div>
471 <!-- ========================================== -->
472 <!-- = PARAGRAPH TAGS = -->
473 <!-- = (can contain inline and special tags) = -->
474 <!-- ========================================== -->
476 <xsl:template match="autor_utworu" mode="header">
477 <span class="author"><xsl:apply-templates mode="inline" /></span>
480 <xsl:template match="nazwa_utworu" mode="header">
481 <span class="title"><xsl:apply-templates mode="inline" /></span>
484 <xsl:template match="dzielo_nadrzedne" mode="header">
485 <span class="collection"><xsl:apply-templates mode="inline" /></span>
488 <xsl:template match="podtytul" mode="header">
489 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
492 <!-- Section headers (included in index)-->
493 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
494 <h2><xsl:apply-templates mode="inline" /></h2>
497 <xsl:template match="naglowek_scena|naglowek_rozdzial">
498 <h3><xsl:apply-templates mode="inline" /></h3>
501 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
502 <h4><xsl:apply-templates mode="inline" /></h4>
505 <!-- Other paragraph tags -->
506 <xsl:template match="miejsce_czas">
507 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
510 <xsl:template match="didaskalia">
511 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
514 <xsl:template match="lista_osoba">
515 <li><xsl:apply-templates mode="inline" /></li>
518 <xsl:template match="akap|akap_dialog|akap_cd">
519 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
522 <xsl:template match="strofa">
525 <xsl:when test="count(br) > 0">
526 <xsl:call-template name="verse">
527 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
528 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
530 <xsl:for-each select="br">
531 <!-- Each BR tag "consumes" text after it -->
532 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
533 <xsl:call-template name="verse">
534 <xsl:with-param name="verse-content"
535 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
536 <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]" />
541 <xsl:call-template name="verse">
542 <xsl:with-param name="verse-content" select="text() | node()" />
543 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
550 <xsl:template name="verse">
551 <xsl:param name="verse-content" />
552 <xsl:param name="verse-type" />
555 <xsl:when test="name($verse-type) = 'wers_akap'">
556 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
558 <xsl:when test="name($verse-type) = 'wers_wciety'">
560 <xsl:when test="$verse-content/@typ">
561 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
564 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
568 <xsl:when test="name($verse-type) = 'wers_cd'">
569 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
572 <xsl:apply-templates select="$verse-content" mode="inline" />
576 <xsl:template match="motto_podpis">
577 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
581 <!-- ================================================ -->
582 <!-- = INLINE TAGS = -->
583 <!-- = (contain other inline tags and special tags) = -->
584 <!-- ================================================ -->
586 <xsl:template match="pa|pe|pr|pt" mode="inline">
587 <a name="{concat('anchor-', generate-id(.))}" />
588 <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>
591 <!-- Other inline tags -->
592 <xsl:template match="mat" mode="inline">
593 <em class="math"><xsl:apply-templates mode="inline" /></em>
596 <xsl:template match="didask_tekst" mode="inline">
597 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
600 <xsl:template match="slowo_obce" mode="inline">
601 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
604 <xsl:template match="tytul_dziela" mode="inline">
605 <em class="book-title">
606 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
610 <xsl:template match="wyroznienie" mode="inline">
611 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
614 <xsl:template match="osoba" mode="inline">
615 <em class="person"><xsl:apply-templates mode="inline" /></em>
619 <!-- ============================================== -->
620 <!-- = STANDALONE TAGS = -->
621 <!-- = (cannot contain any other tags) = -->
622 <!-- ============================================== -->
623 <xsl:template match="sekcja_swiatlo">
624 <hr class="spacer" />
627 <xsl:template match="sekcja_asterysk">
628 <p class="spacer-asterisk">*</p>
631 <xsl:template match="separator_linia">
632 <hr class="spacer-line" />
636 <!-- ================ -->
637 <!-- = SPECIAL TAGS = -->
638 <!-- ================ -->
640 <xsl:template match="begin" mode="inline">
641 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
642 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
643 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
647 <xsl:template match="end" mode="inline">
648 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
651 <xsl:template match="begin|end">
652 <xsl:apply-templates select='.' mode="inline" />
655 <xsl:template match="motyw" mode="inline" />
658 <xsl:template match="nota_red" mode="special">
660 <xsl:apply-templates />
665 <!-- ================ -->
666 <!-- = IGNORED TAGS = -->
667 <!-- ================ -->
668 <xsl:template match="extra|uwaga" />
669 <xsl:template match="extra|uwaga" mode="inline" />
671 <xsl:template match="nota_red" />
676 <xsl:template match="text()" />
677 <xsl:template match="text()" mode="inline">
678 <xsl:value-of select="wl:substitute_entities(.)" />