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">
15 <title>Książka z serwisu WolneLektury.pl</title>
16 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
21 font: Georgia, "Times New Roman", serif;
28 text-decoration: none;
36 /* ================================== */
37 /* = Header with logo and menu = */
38 /* ================================== */
40 margin: 3.4em 0 0 1.4em;
75 #menu li a:hover, #menu li a:active {
77 background: #FFF url(/media/img/arrow-down.png) no-repeat center right;
82 background: #FFF url(/media/img/arrow-up.png) no-repeat center right;
92 border-bottom: 0.25em solid #DDD;
93 border-right: 0.25em solid #DDD;
101 #toc ol, #themes ol {
112 padding: 0 0 1.5em 1.5em;
132 /* =================================================== */
133 /* = Common elements: headings, paragraphs and lines = */
134 /* =================================================== */
167 /* ======================== */
168 /* = Footnotes and themes = */
169 /* ======================== */
171 border-left: 0.1em solid #DDDDDD;
179 margin-right: -9.5em;
192 #footnotes .annotation {
217 margin: -0.25em -0.5em;
223 padding: 0.25em 0.5em;
227 .anchor:hover, #book-text .anchor:active {
229 background-color: #CCC;
232 /* =================== */
233 /* = Custom elements = */
234 /* =================== */
239 margin-bottom: 0.25em;
246 margin-bottom: -0.25em;
258 margin: 0.5em 0 0 1.5em;
269 div.kwestia div.stanza {
290 border-bottom: 0.1em solid #999;
291 padding-bottom: 1.5em;
294 div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
307 border-bottom: 0.1em solid #000;
318 padding: 0 0 0 1.5em;
325 em.math, em.foreign-word, em.book-title, em.didaskalia {
330 letter-spacing: 0.1em;
335 font-variant: small-caps;
340 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
341 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
344 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
346 <a name="{concat('footnote-', generate-id(.))}" />
347 <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>
349 <xsl:when test="count(akap|akap_cd|strofa) = 0">
350 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
353 <xsl:apply-templates select="text()|*" mode="inline" />
366 <!-- ============================================================================== -->
367 <!-- = MASTER TAG = -->
368 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
369 <!-- ============================================================================== -->
370 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
371 <xsl:apply-templates select="nota_red" mode="special" />
372 <xsl:if test="nazwa_utworu">
374 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
377 <xsl:apply-templates />
381 <!-- ==================================================================================== -->
382 <!-- = BLOCK TAGS = -->
383 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
384 <!-- ==================================================================================== -->
385 <xsl:template match="nota">
386 <div class="note"><xsl:apply-templates /></div>
389 <xsl:template match="lista_osob">
390 <div class="person-list">
391 <h3><xsl:value-of select="naglowek_listy" /></h3>
393 <xsl:apply-templates select="lista_osoba" />
398 <xsl:template match="dedykacja">
399 <div class="dedication"><xsl:apply-templates /></div>
402 <xsl:template match="kwestia">
403 <div class="kwestia">
404 <xsl:apply-templates select="strofa|akap|didaskalia" />
408 <xsl:template match="dlugi_cytat|poezja_cyt">
409 <blockquote><xsl:apply-templates /></blockquote>
412 <xsl:template match="motto">
413 <div class="motto"><xsl:apply-templates mode="inline" /></div>
417 <!-- ========================================== -->
418 <!-- = PARAGRAPH TAGS = -->
419 <!-- = (can contain inline and special tags) = -->
420 <!-- ========================================== -->
422 <xsl:template match="autor_utworu" mode="header">
423 <span class="author"><xsl:apply-templates mode="inline" /></span>
426 <xsl:template match="nazwa_utworu" mode="header">
427 <span class="title"><xsl:apply-templates mode="inline" /></span>
430 <xsl:template match="dzielo_nadrzedne" mode="header">
431 <span class="collection"><xsl:apply-templates mode="inline" /></span>
434 <xsl:template match="podtytul" mode="header">
435 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
438 <!-- Section headers (included in index)-->
439 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
440 <h2><xsl:apply-templates mode="inline" /></h2>
443 <xsl:template match="naglowek_scena|naglowek_rozdzial">
444 <h3><xsl:apply-templates mode="inline" /></h3>
447 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
448 <h4><xsl:apply-templates mode="inline" /></h4>
451 <!-- Other paragraph tags -->
452 <xsl:template match="miejsce_czas">
453 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
456 <xsl:template match="didaskalia">
457 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
460 <xsl:template match="lista_osoba">
461 <li><xsl:apply-templates mode="inline" /></li>
464 <xsl:template match="akap|akap_dialog|akap_cd">
465 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
468 <xsl:template match="strofa">
471 <xsl:when test="count(br) > 0">
472 <xsl:call-template name="verse">
473 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
474 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
476 <xsl:for-each select="br">
477 <!-- Each BR tag "consumes" text after it -->
478 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
479 <xsl:call-template name="verse">
480 <xsl:with-param name="verse-content"
481 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
482 <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]" />
487 <xsl:call-template name="verse">
488 <xsl:with-param name="verse-content" select="text() | node()" />
489 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
496 <xsl:template name="verse">
497 <xsl:param name="verse-content" />
498 <xsl:param name="verse-type" />
501 <xsl:when test="name($verse-type) = 'wers_akap'">
502 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
504 <xsl:when test="name($verse-type) = 'wers_wciety'">
506 <xsl:when test="$verse-content/@typ">
507 <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
510 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
514 <xsl:when test="name($verse-type) = 'wers_cd'">
515 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
518 <xsl:apply-templates select="$verse-content" mode="inline" />
522 <xsl:template match="motto_podpis">
523 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
527 <!-- ================================================ -->
528 <!-- = INLINE TAGS = -->
529 <!-- = (contain other inline tags and special tags) = -->
530 <!-- ================================================ -->
532 <xsl:template match="pa|pe|pr|pt" mode="inline">
533 <a name="{concat('anchor-', generate-id(.))}" />
534 <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>
537 <!-- Other inline tags -->
538 <xsl:template match="mat" mode="inline">
539 <em class="math"><xsl:apply-templates mode="inline" /></em>
542 <xsl:template match="didask_tekst" mode="inline">
543 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
546 <xsl:template match="slowo_obce" mode="inline">
547 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
550 <xsl:template match="tytul_dziela" mode="inline">
551 <em class="book-title">
552 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
556 <xsl:template match="wyroznienie" mode="inline">
557 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
560 <xsl:template match="osoba" mode="inline">
561 <em class="person"><xsl:apply-templates mode="inline" /></em>
565 <!-- ============================================== -->
566 <!-- = STANDALONE TAGS = -->
567 <!-- = (cannot contain any other tags) = -->
568 <!-- ============================================== -->
569 <xsl:template match="sekcja_swiatlo">
570 <hr class="spacer" />
573 <xsl:template match="sekcja_asterysk">
574 <p class="spacer-asterisk">*</p>
577 <xsl:template match="separator_linia">
578 <hr class="spacer-line" />
582 <!-- ================ -->
583 <!-- = SPECIAL TAGS = -->
584 <!-- ================ -->
586 <xsl:template match="begin" mode="inline">
587 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
588 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
589 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
593 <xsl:template match="end" mode="inline">
594 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
597 <xsl:template match="begin|end">
598 <xsl:apply-templates select='.' mode="inline" />
601 <xsl:template match="motyw" mode="inline" />
604 <xsl:template match="nota_red" mode="special">
606 <xsl:apply-templates />
611 <!-- ================ -->
612 <!-- = IGNORED TAGS = -->
613 <!-- ================ -->
614 <xsl:template match="extra|uwaga" />
615 <xsl:template match="extra|uwaga" mode="inline" />
617 <xsl:template match="nota_red" />
622 <xsl:template match="text()" />
623 <xsl:template match="text()" mode="inline">
624 <xsl:value-of select="wl:substitute_entities(.)" />