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 method="xml" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes" />
6 <xsl:template match="text()" />
7 <xsl:template match="text()" mode="inline">
8 <xsl:value-of select="wl:substitute_entities(.)" />
11 <xsl:template match="extra|uwaga" />
12 <xsl:template match="extra|uwaga" mode="inline" />
14 <xsl:template match="utwor">
17 <title>book2html output</title>
18 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
19 <link rel="stylesheet" href="master.css" type="text/css" media="all" charset="utf-8" />
22 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
23 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
26 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
28 <a name="{concat('footnote-', generate-id(.))}" />
29 <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>
31 <xsl:when test="count(akap|akap_cd|strofa) = 0">
32 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
35 <xsl:apply-templates select="text()|*" mode="inline" />
47 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
48 <xsl:if test="nazwa_utworu">
50 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
53 <xsl:apply-templates />
56 <!-- ======================= -->
57 <!-- = Header (title page) = -->
58 <!-- ======================= -->
59 <xsl:template match="autor_utworu" mode="header">
60 <span class="author"><xsl:apply-templates mode="inline" /></span>
63 <xsl:template match="nazwa_utworu" mode="header">
64 <span class="title"><xsl:apply-templates mode="inline" /></span>
67 <xsl:template match="dzielo_nadrzedne" mode="header">
68 <span class="collection"><xsl:apply-templates mode="inline" /></span>
71 <xsl:template match="podtytul" mode="header">
72 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
75 <xsl:template match="nota">
76 <div class="note"><xsl:apply-templates /></div>
79 <xsl:template match="dedykacja">
80 <div class="dedication"><xsl:apply-templates /></div>
83 <!-- =================== -->
84 <!-- = Section headers = -->
85 <!-- =================== -->
86 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
87 <h2><xsl:apply-templates mode="inline" /></h2>
90 <xsl:template match="naglowek_scena|naglowek_rozdzial">
91 <h3><xsl:apply-templates mode="inline" /></h3>
94 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
95 <h4><xsl:apply-templates mode="inline" /></h4>
98 <xsl:template match="miejsce_czas">
99 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
102 <xsl:template match="kwestia">
103 <div class="kwestia">
104 <xsl:apply-templates select="strofa|akap" />
108 <xsl:template match="didaskalia">
109 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
112 <xsl:template match="lista_osob">
113 <div class="person-list">
114 <h3><xsl:value-of select="naglowek_listy" /></h3>
116 <xsl:apply-templates select="lista_osoba" />
121 <xsl:template match="lista_osoba">
122 <li><xsl:apply-templates mode="inline" /></li>
125 <xsl:template match="begin" mode="inline">
126 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
127 <span class="theme-begin" fid="{substring(@id, 2)}">
128 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
132 <xsl:template match="end" mode="inline">
133 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
136 <xsl:template match="begin|end">
137 <xsl:apply-templates select='.' mode="inline" />
140 <xsl:template name="verse">
141 <xsl:param name="line-content" />
142 <xsl:param name="line-number" />
145 <xsl:when test="name($line-content) = 'wers_akap'">
146 <xsl:attribute name="style">indent: 1em</xsl:attribute>
148 <xsl:when test="name($line-content) = 'wers_wciety'">
149 <xsl:attribute name="style">indent: 2em</xsl:attribute>
152 <xsl:apply-templates select="$line-content" mode="inline" />
156 <xsl:template match="pa|pe|pr|pt" mode="inline">
157 <a name="{concat('anchor-', generate-id(.))}" />
158 <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>
161 <xsl:template match="strofa">
164 <xsl:when test="count(br) > 0">
165 <xsl:call-template name="verse">
166 <xsl:with-param name="line-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
167 <xsl:with-param name="line-number" select="1" />
169 <xsl:for-each select="br">
170 <!-- Każdy BR "zjada" to co jest za nim -->
171 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
172 <xsl:call-template name="verse">
173 <xsl:with-param name="line-number" select="$lnum+2" />
174 <xsl:with-param name="line-content"
175 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
180 <xsl:call-template name="verse">
181 <xsl:with-param name="line-content" select="text() | node()" />
182 <xsl:with-param name="line-number" select="1" />
189 <xsl:template match="akap|akap_dialog|akap_cd">
190 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
193 <xsl:template match="motyw" mode="inline" />
195 <xsl:template match="dlugi_cytat">
196 <blockquote><xsl:apply-templates /></blockquote>
199 <xsl:template match="motto">
200 <p class="motto"><xsl:apply-templates mode="inline" /></p>
203 <xsl:template match="motto_podpis">
204 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
207 <xsl:template match="sekcja_swiatlo">
208 <hr class="spacer" />