1 <?xml version="1.0" encoding="utf-8"?>
4 This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
8 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:wl="http://wolnelektury.pl/functions" >
11 <xsl:output encoding="utf-8" method="text" />
13 <xsl:param name="wrapping" select="0" />
15 <!-- ============================================================================== -->
16 <!-- = MASTER TAG = -->
17 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
18 <!-- ============================================================================== -->
19 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
20 <xsl:if test="nazwa_utworu"><xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" /></xsl:if>
24 <xsl:apply-templates />
28 <!-- ==================================================================================== -->
29 <!-- = BLOCK TAGS = -->
30 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
31 <!-- ==================================================================================== -->
32 <xsl:template match="nota">
33 <xsl:apply-templates />
36 <xsl:template match="lista_osob">
41 <xsl:value-of select="naglowek_listy" />
42 <xsl:apply-templates select="lista_osoba" />
47 <xsl:template match="dedykacja">
51 <xsl:apply-templates />
54 <xsl:template match="kwestia">
55 <xsl:apply-templates select="strofa|akap|didaskalia" />
58 <xsl:template match="dlugi_cytat|poezja_cyt">
61 <xsl:apply-templates />
64 <xsl:template match="motto">
70 <xsl:apply-templates /><xsl:text>
76 <!-- ========================================== -->
77 <!-- = PARAGRAPH TAGS = -->
78 <!-- = (can contain inline and special tags) = -->
79 <!-- ========================================== -->
81 <xsl:template match="autor_utworu" mode="header">
85 <xsl:apply-templates mode="inline" />
88 <xsl:template match="nazwa_utworu" mode="header">
92 <xsl:apply-templates mode="inline" />
95 <xsl:template match="dzielo_nadrzedne" mode="header">
99 <xsl:apply-templates mode="inline" />
102 <xsl:template match="podtytul" mode="header">
105 <xsl:apply-templates mode="inline" />
108 <!-- Section headers (included in index)-->
109 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
116 <xsl:apply-templates mode="inline" />
119 <xsl:template match="naglowek_scena|naglowek_rozdzial">
125 <xsl:apply-templates mode="inline" />
128 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
133 <xsl:apply-templates mode="inline" />
136 <!-- Other paragraph tags -->
137 <xsl:template match="miejsce_czas">
143 <xsl:apply-templates mode="inline" />
146 <xsl:template match="didaskalia">
147 <xsl:variable name="content">
148 <xsl:apply-templates select="*|text()" mode="inline" />
152 / </xsl:text><xsl:value-of select="wl:wrap_words(wl:strip($content), $wrapping)" /><xsl:text> /</xsl:text>
155 <xsl:template match="lista_osoba">
158 <xsl:apply-templates mode="inline" />
161 <xsl:template match="akap|akap_dialog|akap_cd">
162 <xsl:variable name="content">
163 <xsl:apply-templates select="*|text()" mode="inline" />
168 <xsl:value-of select="wl:wrap_words(wl:strip($content), $wrapping)" />
171 <xsl:template match="strofa">
175 <xsl:when test="count(br) > 0">
176 <xsl:call-template name="verse">
177 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
178 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
180 <xsl:for-each select="br">
181 <!-- Each BR tag "consumes" text after it -->
182 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
183 <xsl:call-template name="verse">
184 <xsl:with-param name="verse-content"
185 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
186 <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]" />
191 <xsl:call-template name="verse">
192 <xsl:with-param name="verse-content" select="text() | node()" />
193 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
199 <xsl:template name="verse">
200 <xsl:param name="verse-content" />
201 <xsl:param name="verse-type" />
204 <xsl:variable name="content">
205 <xsl:apply-templates select="$verse-content" mode="inline" />
208 <xsl:when test="name($verse-type) = 'wers_akap'">
209 <xsl:text> </xsl:text>
211 <xsl:when test="name($verse-type) = 'wers_wciety'">
213 <xsl:when test="$verse-content/@typ">
214 <xsl:text> </xsl:text>
217 <xsl:text> </xsl:text>
221 <xsl:when test="name($verse-type) = 'wers_cd'">
222 <xsl:text> </xsl:text>
225 <xsl:value-of select="wl:strip($content)" />
228 <xsl:template match="motto_podpis">
229 <xsl:apply-templates mode="inline" />
233 <!-- ================================================ -->
234 <!-- = INLINE TAGS = -->
235 <!-- = (contain other inline tags and special tags) = -->
236 <!-- ================================================ -->
238 <xsl:template match="pa|pe|pr|pt" mode="inline" />
240 <!-- Other inline tags -->
241 <xsl:template match="mat" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
243 <xsl:template match="didask_tekst" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
245 <xsl:template match="slowo_obce" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
247 <xsl:template match="tytul_dziela" mode="inline">
248 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
251 <xsl:template match="wyroznienie" mode="inline">
252 <xsl:text>*</xsl:text><xsl:apply-templates mode="inline" /><xsl:text>*</xsl:text>
255 <xsl:template match="osoba" mode="inline">
256 <xsl:apply-templates mode="inline" />
260 <!-- ============================================== -->
261 <!-- = STANDALONE TAGS = -->
262 <!-- = (cannot contain any other tags) = -->
263 <!-- ============================================== -->
264 <xsl:template match="sekcja_swiatlo">
272 <xsl:template match="sekcja_asterysk">
280 <xsl:template match="separator_linia">
283 ------------------------------------------------
289 <!-- ================ -->
290 <!-- = SPECIAL TAGS = -->
291 <!-- ================ -->
293 <xsl:template match="begin" mode="inline" />
295 <xsl:template match="end" mode="inline" />
297 <xsl:template match="begin|end" />
299 <xsl:template match="motyw" mode="inline" />
302 <!-- ================ -->
303 <!-- = IGNORED TAGS = -->
304 <!-- ================ -->
305 <xsl:template match="extra|uwaga" />
306 <xsl:template match="extra|uwaga" mode="inline" />
308 <xsl:template match="nota_red" />
313 <xsl:template match="text()" />
314 <xsl:template match="text()" mode="inline">
315 <xsl:value-of select="wl:substitute_entities(.)" />