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" />
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" />
16 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
17 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
20 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
22 <a name="{concat('footnote-', generate-id(.))}" />
23 <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>
25 <xsl:when test="count(akap|akap_cd|strofa) = 0">
26 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
29 <xsl:apply-templates select="text()|*" mode="inline" />
42 <!-- ============================================================================== -->
43 <!-- = MASTER TAG = -->
44 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
45 <!-- ============================================================================== -->
46 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
47 <xsl:if test="nazwa_utworu">
49 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" />
52 <xsl:apply-templates />
56 <!-- ==================================================================================== -->
57 <!-- = BLOCK TAGS = -->
58 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
59 <!-- ==================================================================================== -->
60 <xsl:template match="nota">
61 <div class="note"><xsl:apply-templates /></div>
64 <xsl:template match="lista_osob">
65 <div class="person-list">
66 <h3><xsl:value-of select="naglowek_listy" /></h3>
68 <xsl:apply-templates select="lista_osoba" />
73 <xsl:template match="dedykacja">
74 <div class="dedication"><xsl:apply-templates /></div>
77 <xsl:template match="kwestia">
79 <xsl:apply-templates select="strofa|akap" />
83 <xsl:template match="dlugi_cytat|poezja_cyt">
84 <blockquote><xsl:apply-templates /></blockquote>
87 <xsl:template match="motto">
88 <div class="motto"><xsl:apply-templates mode="inline" /></div>
92 <!-- ========================================== -->
93 <!-- = PARAGRAPH TAGS = -->
94 <!-- = (can contain inline and special tags) = -->
95 <!-- ========================================== -->
97 <xsl:template match="autor_utworu" mode="header">
98 <span class="author"><xsl:apply-templates mode="inline" /></span>
101 <xsl:template match="nazwa_utworu" mode="header">
102 <span class="title"><xsl:apply-templates mode="inline" /></span>
105 <xsl:template match="dzielo_nadrzedne" mode="header">
106 <span class="collection"><xsl:apply-templates mode="inline" /></span>
109 <xsl:template match="podtytul" mode="header">
110 <span class="subtitle"><xsl:apply-templates mode="inline" /></span>
113 <!-- Section headers (included in index)-->
114 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
115 <h2><xsl:apply-templates mode="inline" /></h2>
118 <xsl:template match="naglowek_scena|naglowek_rozdzial">
119 <h3><xsl:apply-templates mode="inline" /></h3>
122 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
123 <h4><xsl:apply-templates mode="inline" /></h4>
126 <!-- Other paragraph tags -->
127 <xsl:template match="miejsce_czas">
128 <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
131 <xsl:template match="didaskalia">
132 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
135 <xsl:template match="lista_osoba">
136 <li><xsl:apply-templates mode="inline" /></li>
139 <xsl:template match="akap|akap_dialog|akap_cd">
140 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
143 <xsl:template match="strofa">
146 <xsl:when test="count(br) > 0">
147 <xsl:call-template name="verse">
148 <xsl:with-param name="line-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
149 <xsl:with-param name="line-number" select="1" />
151 <xsl:for-each select="br">
152 <!-- Each BR tag "consumes" text after it -->
153 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
154 <xsl:call-template name="verse">
155 <xsl:with-param name="line-number" select="$lnum+2" />
156 <xsl:with-param name="line-content"
157 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
162 <xsl:call-template name="verse">
163 <xsl:with-param name="line-content" select="text() | node()" />
164 <xsl:with-param name="line-number" select="1" />
171 <xsl:template name="verse">
172 <xsl:param name="line-content" />
173 <xsl:param name="line-number" />
176 <xsl:when test="name($line-content) = 'wers_akap'">
177 <xsl:attribute name="style">padding-left: 1em</xsl:attribute>
179 <xsl:when test="name($line-content) = 'wers_wciety'">
180 <xsl:attribute name="style">padding-left: <xsl:value-of select="$line-content/@typ" />em</xsl:attribute>
183 <xsl:apply-templates select="$line-content" mode="inline" />
187 <xsl:template match="motto_podpis">
188 <p class="motto_podpis"><xsl:apply-templates mode="inline" /></p>
192 <!-- ================================================ -->
193 <!-- = INLINE TAGS = -->
194 <!-- = (contain other inline tags and special tags) = -->
195 <!-- ================================================ -->
197 <xsl:template match="pa|pe|pr|pt" mode="inline">
198 <a name="{concat('anchor-', generate-id(.))}" />
199 <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>
202 <!-- Other inline tags -->
203 <xsl:template match="mat" mode="inline">
204 <em class="math"><xsl:apply-templates mode="inline" /></em>
207 <xsl:template match="didask_tekst" mode="inline">
208 <em class="didaskalia"><xsl:apply-templates mode="inline" /></em>
211 <xsl:template match="slowo_obce" mode="inline">
212 <em class="foreign-word"><xsl:apply-templates mode="inline" /></em>
215 <xsl:template match="tytul_dziela" mode="inline">
216 <em class="book-title">
217 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
221 <xsl:template match="wyroznienie" mode="inline">
222 <em class="author-emphasis"><xsl:apply-templates mode="inline" /></em>
225 <xsl:template match="osoba" mode="inline">
226 <em class="person"><xsl:apply-templates mode="inline" /></em>
230 <!-- ============================================== -->
231 <!-- = STANDALONE TAGS = -->
232 <!-- = (cannot contain any other tags) = -->
233 <!-- ============================================== -->
234 <xsl:template match="sekcja_swiatlo">
235 <hr class="spacer" />
238 <xsl:template match="sekcja_asterysk">
239 <p class="spacer-asterisk">*</p>
242 <xsl:template match="separator_linia">
243 <hr class="spacer-line" />
247 <!-- ================ -->
248 <!-- = SPECIAL TAGS = -->
249 <!-- ================ -->
251 <xsl:template match="begin" mode="inline">
252 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
253 <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
254 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
258 <xsl:template match="end" mode="inline">
259 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
262 <xsl:template match="begin|end">
263 <xsl:apply-templates select='.' mode="inline" />
266 <xsl:template match="motyw" mode="inline" />
269 <!-- ================ -->
270 <!-- = IGNORED TAGS = -->
271 <!-- ================ -->
272 <xsl:template match="extra|uwaga" />
273 <xsl:template match="extra|uwaga" mode="inline" />
279 <xsl:template match="text()" />
280 <xsl:template match="text()" mode="inline">
281 <xsl:value-of select="wl:substitute_entities(.)" />