1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
   2     xmlns:wl="http://wolnelektury.pl/functions" >
 
   4 <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" />
 
   7 <xsl:template match="utwor">
 
  10             <title>Książka z serwisu WolneLektury.pl</title>
 
  11             <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
 
  16                 font: Georgia, "Times New Roman", serif;
 
  23                 text-decoration: none;
 
  31             /* ================================== */
 
  32             /* = Header with logo and menu      = */
 
  33             /* ================================== */
 
  35                 margin: 3.4em 0 0 1.4em;
 
  70             #menu li a:hover, #menu li a:active {
 
  72                 background: #FFF url(/media/img/arrow-down.png) no-repeat center right;
 
  77                 background: #FFF url(/media/img/arrow-up.png) no-repeat center right;
 
  87                 border-bottom: 0.25em solid #DDD;
 
  88                 border-right: 0.25em solid #DDD;
 
 107                 padding: 0 0 1.5em 1.5em;
 
 127             /* =================================================== */
 
 128             /* = Common elements: headings, paragraphs and lines = */
 
 129             /* =================================================== */
 
 162             /* ======================== */
 
 163             /* = Footnotes and themes = */
 
 164             /* ======================== */
 
 166                 border-left: 0.1em solid #DDDDDD;
 
 174                 margin-right: -9.5em;
 
 187             #footnotes .annotation {
 
 212                 margin: -0.25em -0.5em;
 
 218                 padding: 0.25em 0.5em;
 
 222             .anchor:hover, #book-text .anchor:active {
 
 224                 background-color: #CCC;
 
 227             /* =================== */
 
 228             /* = Custom elements = */
 
 229             /* =================== */
 
 234                 margin-bottom: 0.25em;
 
 241                 margin-bottom: -0.25em;
 
 253                 margin: 0.5em 0 0 1.5em;
 
 264             div.kwestia div.stanza {
 
 285                 border-bottom: 0.1em solid #999;
 
 286                 padding-bottom: 1.5em;
 
 289             div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
 
 302                 border-bottom: 0.1em solid #000;
 
 313                 padding: 0 0 0 1.5em;
 
 320             em.math, em.foreign-word, em.book-title, em.didaskalia {
 
 325                 letter-spacing: 0.1em;
 
 330                 font-variant: small-caps;
 
 335             <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
 
 336             <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
 
 339                     <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
 
 341                             <a name="{concat('footnote-', generate-id(.))}" />
 
 342                             <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>
 
 344                                 <xsl:when test="count(akap|akap_cd|strofa) = 0">
 
 345                                     <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
 
 348                                     <xsl:apply-templates select="text()|*" mode="inline" />
 
 361 <!-- ============================================================================== -->
 
 362 <!-- = MASTER TAG                                                                 = -->
 
 363 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
 
 364 <!-- ============================================================================== -->
 
 365 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
 
 366     <xsl:if test="nazwa_utworu">
 
 368             <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
 
 371     <xsl:apply-templates />
 
 375 <!-- ==================================================================================== -->
 
 376 <!-- = BLOCK TAGS                                                                       = -->
 
 377 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
 
 378 <!-- ==================================================================================== -->
 
 379 <xsl:template match="nota">
 
 380     <div class="note"><xsl:apply-templates /></div>
 
 383 <xsl:template match="lista_osob">
 
 384     <div class="person-list">
 
 385         <h3><xsl:value-of select="naglowek_listy" /></h3>
 
 387             <xsl:apply-templates select="lista_osoba" />
 
 392 <xsl:template match="dedykacja">
 
 393     <div class="dedication"><xsl:apply-templates /></div>
 
 396 <xsl:template match="kwestia">
 
 397     <div class="kwestia">
 
 398         <xsl:apply-templates select="strofa|akap|didaskalia" />
 
 402 <xsl:template match="dlugi_cytat|poezja_cyt">
 
 403     <blockquote><xsl:apply-templates /></blockquote>
 
 406 <xsl:template match="motto">
 
 407     <div class="motto"><xsl:apply-templates mode="inline" /></div>
 
 411 <!-- ========================================== -->
 
 412 <!-- = PARAGRAPH TAGS                         = -->
 
 413 <!-- = (can contain inline and special tags)  = -->
 
 414 <!-- ========================================== -->
 
 416 <xsl:template match="autor_utworu" mode="header">
 
 417     <span class="author"><xsl:apply-templates mode="inline" /></span>
 
 420 <xsl:template match="nazwa_utworu" mode="header">
 
 421     <span class="title"><xsl:apply-templates mode="inline" /></span>
 
 424 <xsl:template match="dzielo_nadrzedne" mode="header">
 
 425     <span class="collection"><xsl:apply-templates mode="inline" /></span>
 
 428 <xsl:template match="podtytul" mode="header">
 
 429     <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
 
 432 <!-- Section headers (included in index)-->
 
 433 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
 
 434     <h2><xsl:apply-templates mode="inline" /></h2>
 
 437 <xsl:template match="naglowek_scena|naglowek_rozdzial">
 
 438     <h3><xsl:apply-templates mode="inline" /></h3>
 
 441 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
 
 442     <h4><xsl:apply-templates mode="inline" /></h4>
 
 445 <!-- Other paragraph tags -->
 
 446 <xsl:template match="miejsce_czas">
 
 447     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
 
 450 <xsl:template match="didaskalia">
 
 451     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
 
 454 <xsl:template match="lista_osoba">
 
 455     <li><xsl:apply-templates mode="inline" /></li>
 
 458 <xsl:template match="akap|akap_dialog|akap_cd">
 
 459     <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
 
 462 <xsl:template match="strofa">
 
 465             <xsl:when test="count(br) > 0">     
 
 466                 <xsl:call-template name="verse">
 
 467                     <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
 
 468                     <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
 
 470                 <xsl:for-each select="br">              
 
 471                                 <!-- Each BR tag "consumes" text after it -->
 
 472                     <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
 
 473                     <xsl:call-template name="verse">
 
 474                         <xsl:with-param name="verse-content" 
 
 475                             select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
 
 476                         <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]" />
 
 481                 <xsl:call-template name="verse">
 
 482                     <xsl:with-param name="verse-content" select="text() | node()" />
 
 483                     <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
 
 490 <xsl:template name="verse">
 
 491     <xsl:param name="verse-content" />
 
 492     <xsl:param name="verse-type" />
 
 495             <xsl:when test="name($verse-type) = 'wers_akap'">
 
 496                 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 498             <xsl:when test="name($verse-type) = 'wers_wciety'">
 
 500                     <xsl:when test="$verse-content/@typ">
 
 501                         <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
 
 504                         <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 508             <xsl:when test="name($verse-type) = 'wers_cd'">
 
 509                 <xsl:attribute name="style">padding-left: 12em</xsl:attribute>
 
 512         <xsl:apply-templates select="$verse-content" mode="inline" />
 
 516 <xsl:template match="motto_podpis">
 
 517     <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
 
 521 <!-- ================================================ -->
 
 522 <!-- = INLINE TAGS                                  = -->
 
 523 <!-- = (contain other inline tags and special tags) = -->
 
 524 <!-- ================================================ -->
 
 526 <xsl:template match="pa|pe|pr|pt" mode="inline">
 
 527     <a name="{concat('anchor-', generate-id(.))}" />
 
 528     <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>
 
 531 <!-- Other inline tags -->
 
 532 <xsl:template match="mat" mode="inline">
 
 533     <em class="math"><xsl:apply-templates mode="inline" /></em>
 
 536 <xsl:template match="didask_tekst" mode="inline">
 
 537     <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
 
 540 <xsl:template match="slowo_obce" mode="inline">
 
 541     <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
 
 544 <xsl:template match="tytul_dziela" mode="inline">
 
 545     <em class="book-title">
 
 546         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
 
 550 <xsl:template match="wyroznienie" mode="inline">
 
 551     <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
 
 554 <xsl:template match="osoba" mode="inline">
 
 555     <em class="person"><xsl:apply-templates mode="inline" /></em>
 
 559 <!-- ============================================== -->
 
 560 <!-- = STANDALONE TAGS                            = -->
 
 561 <!-- = (cannot contain any other tags)            = -->
 
 562 <!-- ============================================== -->
 
 563 <xsl:template match="sekcja_swiatlo">
 
 564     <hr class="spacer" />
 
 567 <xsl:template match="sekcja_asterysk">
 
 568     <p class="spacer-asterisk">*</p>
 
 571 <xsl:template match="separator_linia">
 
 572     <hr class="spacer-line" />
 
 576 <!-- ================ -->
 
 577 <!-- = SPECIAL TAGS = -->
 
 578 <!-- ================ -->
 
 580 <xsl:template match="begin" mode="inline">
 
 581     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
 
 582     <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
 
 583         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
 
 587 <xsl:template match="end" mode="inline">
 
 588     <span class="theme-end" fid="{substring(@id, 2)}"> </span>
 
 591 <xsl:template match="begin|end">
 
 592     <xsl:apply-templates select='.' mode="inline" />
 
 595 <xsl:template match="motyw" mode="inline" />
 
 598 <!-- ================ -->
 
 599 <!-- = IGNORED TAGS = -->
 
 600 <!-- ================ -->
 
 601 <xsl:template match="extra|uwaga" />
 
 602 <xsl:template match="extra|uwaga" mode="inline" />
 
 608 <xsl:template match="text()" />
 
 609 <xsl:template match="text()" mode="inline">
 
 610     <xsl:value-of select="wl:substitute_entities(.)" />