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"/>
 
  12             <link rel="stylesheet" href="master.css" type="text/css" media="all" charset="utf-8" />
 
  17                 font: Georgia, "Times New Roman", serif;
 
  25                 text-decoration: none;
 
  28             /* =================================================== */
 
  29             /* = Common elements: headings, paragraphs and lines = */
 
  30             /* =================================================== */
 
  63             /* ======================== */
 
  64             /* = Footnotes and themes = */
 
  65             /* ======================== */
 
  67                 border-left: 0.1em solid #DDDDDD;
 
  90             #footnotes .annotation {
 
 105             /* =================== */
 
 106             /* = Custom elements = */
 
 107             /* =================== */
 
 112                 margin-bottom: 0.25em;
 
 119                 margin-bottom: -0.25em;
 
 142             div.kwestia div.stanza {
 
 162                 border-bottom: 0.1em solid #999;
 
 163                 padding-bottom: 1.5em;
 
 166             div.note p, div.note p.paragraph {
 
 186             <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
 
 187             <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
 
 190                     <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
 
 192                             <a name="{concat('footnote-', generate-id(.))}" />
 
 193                             <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>
 
 195                                 <xsl:when test="count(akap|akap_cd|strofa) = 0">
 
 196                                     <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
 
 199                                     <xsl:apply-templates select="text()|*" mode="inline" />
 
 212 <!-- ============================================================================== -->
 
 213 <!-- = MASTER TAG                                                                 = -->
 
 214 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
 
 215 <!-- ============================================================================== -->
 
 216 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
 
 217     <xsl:if test="nazwa_utworu">
 
 219             <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
 
 222     <xsl:apply-templates />
 
 226 <!-- ==================================================================================== -->
 
 227 <!-- = BLOCK TAGS                                                                       = -->
 
 228 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
 
 229 <!-- ==================================================================================== -->
 
 230 <xsl:template match="nota">
 
 231     <div class="note"><xsl:apply-templates /></div>
 
 234 <xsl:template match="lista_osob">
 
 235     <div class="person-list">
 
 236         <h3><xsl:value-of select="naglowek_listy" /></h3>
 
 238             <xsl:apply-templates select="lista_osoba" />
 
 243 <xsl:template match="dedykacja">
 
 244     <div class="dedication"><xsl:apply-templates /></div>
 
 247 <xsl:template match="kwestia">
 
 248     <div class="kwestia">
 
 249         <xsl:apply-templates select="strofa|akap" />
 
 253 <xsl:template match="dlugi_cytat|poezja_cyt">
 
 254     <blockquote><xsl:apply-templates /></blockquote>
 
 257 <xsl:template match="motto">
 
 258     <div class="motto"><xsl:apply-templates mode="inline" /></div>
 
 262 <!-- ========================================== -->
 
 263 <!-- = PARAGRAPH TAGS                         = -->
 
 264 <!-- = (can contain inline and special tags)  = -->
 
 265 <!-- ========================================== -->
 
 267 <xsl:template match="autor_utworu" mode="header">
 
 268     <span class="author"><xsl:apply-templates mode="inline" /></span>
 
 271 <xsl:template match="nazwa_utworu" mode="header">
 
 272     <span class="title"><xsl:apply-templates mode="inline" /></span>
 
 275 <xsl:template match="dzielo_nadrzedne" mode="header">
 
 276     <span class="collection"><xsl:apply-templates mode="inline" /></span>
 
 279 <xsl:template match="podtytul" mode="header">
 
 280     <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
 
 283 <!-- Section headers (included in index)-->
 
 284 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
 
 285     <h2><xsl:apply-templates mode="inline" /></h2>
 
 288 <xsl:template match="naglowek_scena|naglowek_rozdzial">
 
 289     <h3><xsl:apply-templates mode="inline" /></h3>
 
 292 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
 
 293     <h4><xsl:apply-templates mode="inline" /></h4>
 
 296 <!-- Other paragraph tags -->
 
 297 <xsl:template match="miejsce_czas">
 
 298     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
 
 301 <xsl:template match="didaskalia">
 
 302     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
 
 305 <xsl:template match="lista_osoba">
 
 306     <li><xsl:apply-templates mode="inline" /></li>
 
 309 <xsl:template match="akap|akap_dialog|akap_cd">
 
 310     <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
 
 313 <xsl:template match="strofa">
 
 316             <xsl:when test="count(br) > 0">     
 
 317                 <xsl:call-template name="verse">
 
 318                     <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
 
 319                     <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
 
 321                 <xsl:for-each select="br">              
 
 322                                 <!-- Each BR tag "consumes" text after it -->
 
 323                     <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
 
 324                     <xsl:call-template name="verse">
 
 325                         <xsl:with-param name="verse-content" 
 
 326                             select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
 
 327                         <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]" />
 
 332                 <xsl:call-template name="verse">
 
 333                     <xsl:with-param name="verse-content" select="text() | node()" />
 
 334                     <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
 
 341 <xsl:template name="verse">
 
 342     <xsl:param name="verse-content" />
 
 343     <xsl:param name="verse-type" />
 
 346             <xsl:when test="name($verse-type) = 'wers_akap'">
 
 347                 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 349             <xsl:when test="name($verse-type) = 'wers_wciety'">
 
 351                     <xsl:when test="$verse-content/@typ">
 
 352                         <xsl:attribute name="style">padding-left: <xsl:value-of select="$verse-content/@typ" />em</xsl:attribute>
 
 355                         <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
 
 360         <xsl:apply-templates select="$verse-content" mode="inline" />
 
 364 <xsl:template match="motto_podpis">
 
 365     <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
 
 369 <!-- ================================================ -->
 
 370 <!-- = INLINE TAGS                                  = -->
 
 371 <!-- = (contain other inline tags and special tags) = -->
 
 372 <!-- ================================================ -->
 
 374 <xsl:template match="pa|pe|pr|pt" mode="inline">
 
 375     <a name="{concat('anchor-', generate-id(.))}" />
 
 376     <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>
 
 379 <!-- Other inline tags -->
 
 380 <xsl:template match="mat" mode="inline">
 
 381     <em class="math"><xsl:apply-templates mode="inline" /></em>
 
 384 <xsl:template match="didask_tekst" mode="inline">
 
 385     <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
 
 388 <xsl:template match="slowo_obce" mode="inline">
 
 389     <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
 
 392 <xsl:template match="tytul_dziela" mode="inline">
 
 393     <em class="book-title">
 
 394         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
 
 398 <xsl:template match="wyroznienie" mode="inline">
 
 399     <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
 
 402 <xsl:template match="osoba" mode="inline">
 
 403     <em class="person"><xsl:apply-templates mode="inline" /></em>
 
 407 <!-- ============================================== -->
 
 408 <!-- = STANDALONE TAGS                            = -->
 
 409 <!-- = (cannot contain any other tags)            = -->
 
 410 <!-- ============================================== -->
 
 411 <xsl:template match="sekcja_swiatlo">
 
 412     <hr class="spacer" />
 
 415 <xsl:template match="sekcja_asterysk">
 
 416     <p class="spacer-asterisk">*</p>
 
 419 <xsl:template match="separator_linia">
 
 420     <hr class="spacer-line" />
 
 424 <!-- ================ -->
 
 425 <!-- = SPECIAL TAGS = -->
 
 426 <!-- ================ -->
 
 428 <xsl:template match="begin" mode="inline">
 
 429     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
 
 430     <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
 
 431         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
 
 435 <xsl:template match="end" mode="inline">
 
 436     <span class="theme-end" fid="{substring(@id, 2)}"> </span>
 
 439 <xsl:template match="begin|end">
 
 440     <xsl:apply-templates select='.' mode="inline" />
 
 443 <xsl:template match="motyw" mode="inline" />
 
 446 <!-- ================ -->
 
 447 <!-- = IGNORED TAGS = -->
 
 448 <!-- ================ -->
 
 449 <xsl:template match="extra|uwaga" />
 
 450 <xsl:template match="extra|uwaga" mode="inline" />
 
 456 <xsl:template match="text()" />
 
 457 <xsl:template match="text()" mode="inline">
 
 458     <xsl:value-of select="wl:substitute_entities(.)" />