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" method="text" />
6 <xsl:param name="wrapping" select="0" />
8 <!-- ============================================================================== -->
9 <!-- = MASTER TAG = -->
10 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
11 <!-- ============================================================================== -->
12 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
13 <xsl:if test="nazwa_utworu"><xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" /></xsl:if>
17 <xsl:apply-templates />
21 <!-- ==================================================================================== -->
22 <!-- = BLOCK TAGS = -->
23 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
24 <!-- ==================================================================================== -->
25 <xsl:template match="nota">
26 <xsl:apply-templates />
29 <xsl:template match="lista_osob">
34 <xsl:value-of select="naglowek_listy" />
35 <xsl:apply-templates select="lista_osoba" />
40 <xsl:template match="dedykacja">
44 <xsl:apply-templates />
47 <xsl:template match="kwestia">
48 <xsl:apply-templates select="strofa|akap|didaskalia" />
51 <xsl:template match="dlugi_cytat|poezja_cyt">
54 <xsl:apply-templates />
57 <xsl:template match="motto">
63 <xsl:apply-templates /><xsl:text>
69 <!-- ========================================== -->
70 <!-- = PARAGRAPH TAGS = -->
71 <!-- = (can contain inline and special tags) = -->
72 <!-- ========================================== -->
74 <xsl:template match="autor_utworu" mode="header">
78 <xsl:apply-templates mode="inline" />
81 <xsl:template match="nazwa_utworu" mode="header">
85 <xsl:apply-templates mode="inline" />
88 <xsl:template match="dzielo_nadrzedne" mode="header">
92 <xsl:apply-templates mode="inline" />
95 <xsl:template match="podtytul" mode="header">
98 <xsl:apply-templates mode="inline" />
101 <!-- Section headers (included in index)-->
102 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
109 <xsl:apply-templates mode="inline" />
112 <xsl:template match="naglowek_scena|naglowek_rozdzial">
118 <xsl:apply-templates mode="inline" />
121 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
126 <xsl:apply-templates mode="inline" />
129 <!-- Other paragraph tags -->
130 <xsl:template match="miejsce_czas">
136 <xsl:apply-templates mode="inline" />
139 <xsl:template match="didaskalia">
140 <xsl:variable name="content">
141 <xsl:apply-templates select="*|text()" mode="inline" />
145 / </xsl:text><xsl:value-of select="wl:wrap_words(wl:strip($content), $wrapping)" /><xsl:text> /</xsl:text>
148 <xsl:template match="lista_osoba">
151 <xsl:apply-templates mode="inline" />
154 <xsl:template match="akap|akap_dialog|akap_cd">
155 <xsl:variable name="content">
156 <xsl:apply-templates select="*|text()" mode="inline" />
161 <xsl:value-of select="wl:wrap_words(wl:strip($content), $wrapping)" />
164 <xsl:template match="strofa">
168 <xsl:when test="count(br) > 0">
169 <xsl:call-template name="verse">
170 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
171 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
173 <xsl:for-each select="br">
174 <!-- Each BR tag "consumes" text after it -->
175 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
176 <xsl:call-template name="verse">
177 <xsl:with-param name="verse-content"
178 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
179 <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]" />
184 <xsl:call-template name="verse">
185 <xsl:with-param name="verse-content" select="text() | node()" />
186 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
192 <xsl:template name="verse">
193 <xsl:param name="verse-content" />
194 <xsl:param name="verse-type" />
197 <xsl:variable name="content">
198 <xsl:apply-templates select="$verse-content" mode="inline" />
201 <xsl:when test="name($verse-type) = 'wers_akap'">
202 <xsl:text> </xsl:text>
204 <xsl:when test="name($verse-type) = 'wers_wciety'">
206 <xsl:when test="$verse-content/@typ">
207 <xsl:text> </xsl:text>
210 <xsl:text> </xsl:text>
214 <xsl:when test="name($verse-type) = 'wers_cd'">
215 <xsl:text> </xsl:text>
218 <xsl:value-of select="wl:strip($content)" />
221 <xsl:template match="motto_podpis">
222 <xsl:apply-templates mode="inline" />
226 <!-- ================================================ -->
227 <!-- = INLINE TAGS = -->
228 <!-- = (contain other inline tags and special tags) = -->
229 <!-- ================================================ -->
231 <xsl:template match="pa|pe|pr|pt" mode="inline" />
233 <!-- Other inline tags -->
234 <xsl:template match="mat" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
236 <xsl:template match="didask_tekst" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
238 <xsl:template match="slowo_obce" mode="inline"><xsl:apply-templates mode="inline" /></xsl:template>
240 <xsl:template match="tytul_dziela" mode="inline">
241 <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
244 <xsl:template match="wyroznienie" mode="inline">
245 <xsl:text>*</xsl:text><xsl:apply-templates mode="inline" /><xsl:text>*</xsl:text>
248 <xsl:template match="osoba" mode="inline">
249 <xsl:apply-templates mode="inline" />
253 <!-- ============================================== -->
254 <!-- = STANDALONE TAGS = -->
255 <!-- = (cannot contain any other tags) = -->
256 <!-- ============================================== -->
257 <xsl:template match="sekcja_swiatlo">
265 <xsl:template match="sekcja_asterysk">
273 <xsl:template match="separator_linia">
276 ------------------------------------------------
282 <!-- ================ -->
283 <!-- = SPECIAL TAGS = -->
284 <!-- ================ -->
286 <xsl:template match="begin" mode="inline" />
288 <xsl:template match="end" mode="inline" />
290 <xsl:template match="begin|end" />
292 <xsl:template match="motyw" mode="inline" />
295 <!-- ================ -->
296 <!-- = IGNORED TAGS = -->
297 <!-- ================ -->
298 <xsl:template match="extra|uwaga" />
299 <xsl:template match="extra|uwaga" mode="inline" />
305 <xsl:template match="text()" />
306 <xsl:template match="text()" mode="inline">
307 <xsl:value-of select="wl:substitute_entities(.)" />