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" />
7 <xsl:template match="utwor">
10 <title>book2html output</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" />
15 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
16 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
19 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
21 <a name="{concat('footnote-', generate-id(.))}" />
22 <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>
24 <xsl:when test="count(akap|akap_cd|strofa) = 0">
25 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
28 <xsl:apply-templates select="text()|*" mode="inline" />
40 <!-- ============================================================================== -->
41 <!-- = MASTER TAG = -->
42 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
43 <!-- ============================================================================== -->
44 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
45 <xsl:if test="nazwa_utworu">
47 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
50 <xsl:apply-templates />
54 <!-- ==================================================================================== -->
55 <!-- = BLOCK TAGS = -->
56 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
57 <!-- ==================================================================================== -->
58 <xsl:template match="nota">
59 <div class="note"><xsl:apply-templates /></div>
62 <xsl:template match="lista_osob">
63 <div class="person-list">
64 <h3><xsl:value-of select="naglowek_listy" /></h3>
66 <xsl:apply-templates select="lista_osoba" />
71 <xsl:template match="dedykacja">
72 <div class="dedication"><xsl:apply-templates /></div>
75 <xsl:template match="kwestia">
77 <xsl:apply-templates select="strofa|akap" />
81 <xsl:template match="dlugi_cytat|poezja_cyt">
82 <blockquote><xsl:apply-templates /></blockquote>
85 <xsl:template match="motto">
86 <div class="motto"><xsl:apply-templates mode="inline" /></div>
90 <!-- ========================================== -->
91 <!-- = PARAGRAPH TAGS = -->
92 <!-- = (can contain inline and special tags) = -->
93 <!-- ========================================== -->
95 <xsl:template match="autor_utworu" mode="header">
96 <span class="author"><xsl:apply-templates mode="inline" /></span>
99 <xsl:template match="nazwa_utworu" mode="header">
100 <span class="title"><xsl:apply-templates mode="inline" /></span>
103 <xsl:template match="dzielo_nadrzedne" mode="header">
104 <span class="collection"><xsl:apply-templates mode="inline" /></span>
107 <xsl:template match="podtytul" mode="header">
108 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
111 <!-- Section headers (included in index)-->
112 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
113 <h2><xsl:apply-templates mode="inline" /></h2>
116 <xsl:template match="naglowek_scena|naglowek_rozdzial">
117 <h3><xsl:apply-templates mode="inline" /></h3>
120 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
121 <h4><xsl:apply-templates mode="inline" /></h4>
124 <!-- Other paragraph tags -->
125 <xsl:template match="miejsce_czas">
126 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
129 <xsl:template match="didaskalia">
130 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
133 <xsl:template match="lista_osoba">
134 <li><xsl:apply-templates mode="inline" /></li>
137 <xsl:template match="akap|akap_dialog|akap_cd">
138 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
141 <xsl:template match="strofa">
144 <xsl:when test="count(br) > 0">
145 <xsl:call-template name="verse">
146 <xsl:with-param name="line-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
147 <xsl:with-param name="line-number" select="1" />
149 <xsl:for-each select="br">
150 <!-- Each BR tag "consumes" text after it -->
151 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
152 <xsl:call-template name="verse">
153 <xsl:with-param name="line-number" select="$lnum+2" />
154 <xsl:with-param name="line-content"
155 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
160 <xsl:call-template name="verse">
161 <xsl:with-param name="line-content" select="text() | node()" />
162 <xsl:with-param name="line-number" select="1" />
169 <xsl:template name="verse">
170 <xsl:param name="line-content" />
171 <xsl:param name="line-number" />
174 <xsl:when test="name($line-content) = 'wers_akap'">
175 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
177 <xsl:when test="name($line-content) = 'wers_wciety'">
178 <xsl:attribute name="style">padding-left: <xsl:value-of select="$line-content/@typ" />em</xsl:attribute>
181 <xsl:apply-templates select="$line-content" mode="inline" />
185 <xsl:template match="motto_podpis">
186 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
190 <!-- ================================================ -->
191 <!-- = INLINE TAGS = -->
192 <!-- = (contain other inline tags and special tags) = -->
193 <!-- ================================================ -->
195 <xsl:template match="pa|pe|pr|pt" mode="inline">
196 <a name="{concat('anchor-', generate-id(.))}" />
197 <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>
200 <!-- Other inline tags -->
201 <xsl:template match="mat" mode="inline">
202 <em class="math"><xsl:apply-templates mode="inline" /></em>
205 <xsl:template match="didask_tekst" mode="inline">
206 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
209 <xsl:template match="slowo_obce" mode="inline">
210 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
213 <xsl:template match="tytul_dziela" mode="inline">
214 <em class="book-title">
215 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
219 <xsl:template match="wyroznienie" mode="inline">
220 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
223 <xsl:template match="osoba" mode="inline">
224 <em class="person"><xsl:apply-templates mode="inline" /></em>
228 <!-- ============================================== -->
229 <!-- = STANDALONE TAGS = -->
230 <!-- = (cannot contain any other tags) = -->
231 <!-- ============================================== -->
232 <xsl:template match="sekcja_swiatlo">
233 <hr class="spacer" />
236 <xsl:template match="sekcja_asterysk">
237 <p class="spacer-asterisk">*</p>
240 <xsl:template match="separator_linia">
241 <hr class="spacer-line" />
245 <!-- ================ -->
246 <!-- = SPECIAL TAGS = -->
247 <!-- ================ -->
249 <xsl:template match="begin" mode="inline">
250 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
251 <span class="theme-begin" fid="{substring(@id, 2)}">
252 <a name="m{substring(@id, 2)}" />
253 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
257 <xsl:template match="end" mode="inline">
258 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
261 <xsl:template match="begin|end">
262 <xsl:apply-templates select='.' mode="inline" />
265 <xsl:template match="motyw" mode="inline" />
268 <!-- ================ -->
269 <!-- = IGNORED TAGS = -->
270 <!-- ================ -->
271 <xsl:template match="extra|uwaga" />
272 <xsl:template match="extra|uwaga" mode="inline" />
278 <xsl:template match="text()" />
279 <xsl:template match="text()" mode="inline">
280 <xsl:value-of select="wl:substitute_entities(.)" />