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:if test="nazwa_utworu">
 
 373             <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
 
 376     <xsl:apply-templates />
 
 380 <!-- ==================================================================================== -->
 
 381 <!-- = BLOCK TAGS                                                                       = -->
 
 382 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
 
 383 <!-- ==================================================================================== -->
 
 384 <xsl:template match="nota">
 
 385     <div class="note"><xsl:apply-templates /></div>
 
 388 <xsl:template match="lista_osob">
 
 389     <div class="person-list">
 
 390         <h3><xsl:value-of select="naglowek_listy" /></h3>
 
 392             <xsl:apply-templates select="lista_osoba" />
 
 397 <xsl:template match="dedykacja">
 
 398     <div class="dedication"><xsl:apply-templates /></div>
 
 401 <xsl:template match="kwestia">
 
 402     <div class="kwestia">
 
 403         <xsl:apply-templates select="strofa|akap|didaskalia" />
 
 407 <xsl:template match="dlugi_cytat|poezja_cyt">
 
 408     <blockquote><xsl:apply-templates /></blockquote>
 
 411 <xsl:template match="motto">
 
 412     <div class="motto"><xsl:apply-templates mode="inline" /></div>
 
 416 <!-- ========================================== -->
 
 417 <!-- = PARAGRAPH TAGS                         = -->
 
 418 <!-- = (can contain inline and special tags)  = -->
 
 419 <!-- ========================================== -->
 
 421 <xsl:template match="autor_utworu" mode="header">
 
 422     <span class="author"><xsl:apply-templates mode="inline" /></span>
 
 425 <xsl:template match="nazwa_utworu" mode="header">
 
 426     <span class="title"><xsl:apply-templates mode="inline" /></span>
 
 429 <xsl:template match="dzielo_nadrzedne" mode="header">
 
 430     <span class="collection"><xsl:apply-templates mode="inline" /></span>
 
 433 <xsl:template match="podtytul" mode="header">
 
 434     <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
 
 437 <!-- Section headers (included in index)-->
 
 438 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
 
 439     <h2><xsl:apply-templates mode="inline" /></h2>
 
 442 <xsl:template match="naglowek_scena|naglowek_rozdzial">
 
 443     <h3><xsl:apply-templates mode="inline" /></h3>
 
 446 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
 
 447     <h4><xsl:apply-templates mode="inline" /></h4>
 
 450 <!-- Other paragraph tags -->
 
 451 <xsl:template match="miejsce_czas">
 
 452     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
 
 455 <xsl:template match="didaskalia">
 
 456     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
 
 459 <xsl:template match="lista_osoba">
 
 460     <li><xsl:apply-templates mode="inline" /></li>
 
 463 <xsl:template match="akap|akap_dialog|akap_cd">
 
 464     <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
 
 467 <xsl:template match="strofa">
 
 470             <xsl:when test="count(br) > 0">     
 
 471                 <xsl:call-template name="verse">
 
 472                     <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
 
 473                     <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
 
 475                 <xsl:for-each select="br">              
 
 476                                 <!-- Each BR tag "consumes" text after it -->
 
 477                     <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
 
 478                     <xsl:call-template name="verse">
 
 479                         <xsl:with-param name="verse-content" 
 
 480                             select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
 
 481                         <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]" />
 
 486                 <xsl:call-template name="verse">
 
 487                     <xsl:with-param name="verse-content" select="text() | node()" />
 
 488                     <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
 
 495 <xsl:template name="verse">
 
 496     <xsl:param name="verse-content" />
 
 497     <xsl:param name="verse-type" />
 
 500             <xsl:when test="name($verse-type) = 'wers_akap'">
 
 501                 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 503             <xsl:when test="name($verse-type) = 'wers_wciety'">
 
 505                     <xsl:when test="$verse-content/@typ">
 
 506                         <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
 
 509                         <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 513             <xsl:when test="name($verse-type) = 'wers_cd'">
 
 514                 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
 
 517         <xsl:apply-templates select="$verse-content" mode="inline" />
 
 521 <xsl:template match="motto_podpis">
 
 522     <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
 
 526 <!-- ================================================ -->
 
 527 <!-- = INLINE TAGS                                  = -->
 
 528 <!-- = (contain other inline tags and special tags) = -->
 
 529 <!-- ================================================ -->
 
 531 <xsl:template match="pa|pe|pr|pt" mode="inline">
 
 532     <a name="{concat('anchor-', generate-id(.))}" />
 
 533     <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>
 
 536 <!-- Other inline tags -->
 
 537 <xsl:template match="mat" mode="inline">
 
 538     <em class="math"><xsl:apply-templates mode="inline" /></em>
 
 541 <xsl:template match="didask_tekst" mode="inline">
 
 542     <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
 
 545 <xsl:template match="slowo_obce" mode="inline">
 
 546     <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
 
 549 <xsl:template match="tytul_dziela" mode="inline">
 
 550     <em class="book-title">
 
 551         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
 
 555 <xsl:template match="wyroznienie" mode="inline">
 
 556     <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
 
 559 <xsl:template match="osoba" mode="inline">
 
 560     <em class="person"><xsl:apply-templates mode="inline" /></em>
 
 564 <!-- ============================================== -->
 
 565 <!-- = STANDALONE TAGS                            = -->
 
 566 <!-- = (cannot contain any other tags)            = -->
 
 567 <!-- ============================================== -->
 
 568 <xsl:template match="sekcja_swiatlo">
 
 569     <hr class="spacer" />
 
 572 <xsl:template match="sekcja_asterysk">
 
 573     <p class="spacer-asterisk">*</p>
 
 576 <xsl:template match="separator_linia">
 
 577     <hr class="spacer-line" />
 
 581 <!-- ================ -->
 
 582 <!-- = SPECIAL TAGS = -->
 
 583 <!-- ================ -->
 
 585 <xsl:template match="begin" mode="inline">
 
 586     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
 
 587     <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
 
 588         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
 
 592 <xsl:template match="end" mode="inline">
 
 593     <span class="theme-end" fid="{substring(@id, 2)}"> </span>
 
 596 <xsl:template match="begin|end">
 
 597     <xsl:apply-templates select='.' mode="inline" />
 
 600 <xsl:template match="motyw" mode="inline" />
 
 603 <!-- ================ -->
 
 604 <!-- = IGNORED TAGS = -->
 
 605 <!-- ================ -->
 
 606 <xsl:template match="extra|uwaga" />
 
 607 <xsl:template match="extra|uwaga" mode="inline" />
 
 613 <xsl:template match="text()" />
 
 614 <xsl:template match="text()" mode="inline">
 
 615     <xsl:value-of select="wl:substitute_entities(.)" />