allow strofa inside table + fix table border in html/epub + fix empty verses in epub
[librarian.git] / librarian / pdf / wl2tex.xslt
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3
4    This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5    Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6
7 -->
8 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9     xmlns:wl="http://wolnelektury.pl/functions"
10     xmlns:dc="http://purl.org/dc/elements/1.1/"
11     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
12
13 <xsl:output encoding="utf-8" indent="yes" version="2.0" />
14
15 <xsl:template match="utwor">
16     <TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
17         <TeXML escape="0">
18         \documentclass[<xsl:value-of select="@customizations"/>]{wl}
19
20         <!-- flags and values set on root -->
21
22         \newif\ifflaglessadvertising
23         <xsl:for-each select="@*[starts-with(name(), 'flag-')]">
24             <cmd>
25                 <xsl:attribute name="name"><xsl:value-of select="wl:texcommand(name())" />true</xsl:attribute>
26             </cmd>
27         </xsl:for-each>
28
29         <xsl:for-each select="@*[starts-with(name(), 'data-')]">
30             <TeXML escape="0">
31                 \def\<xsl:value-of select="wl:texcommand(name())" />{<TeXML escape="1"><xsl:value-of select="."/></TeXML>}
32             </TeXML>
33         </xsl:for-each>
34         </TeXML>
35
36         <xsl:choose>
37             <xsl:when test="@morefloats = 'new'">
38                 <TeXML escape="0">
39                     \usepackage[maxfloats=53]{morefloats}
40                 </TeXML>
41             </xsl:when>
42             <xsl:when test="@morefloats = 'old'">
43                 <TeXML escape="0">
44                     \usepackage{morefloats}
45                 </TeXML>
46             </xsl:when>
47             <xsl:when test="@morefloats = 'none'" />
48             <xsl:otherwise>
49                 <TeXML escape="0">
50                     \IfFileExists{morefloats.sty}{
51                         \usepackage{morefloats}
52                     }{}
53                 </TeXML>
54             </xsl:otherwise>
55         </xsl:choose>
56
57         <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
58         <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
59
60         <env name="document">
61             <xsl:if test="@data-cover-width">
62                 <cmd name="makecover">
63                     <parm>210mm</parm>
64                     <parm><xsl:value-of select="210 * @data-cover-height div @data-cover-width" />mm</parm>
65                 </cmd>
66             </xsl:if>
67                 <xsl:if test="@thanks">
68                     <TeXML escape="0">
69                         \def\thanknote{<TeXML escape="1"><xsl:value-of select="@thanks" /></TeXML>}
70                     </TeXML>
71                 </xsl:if>
72             <cmd name="maketitle" />
73
74             <cmd name="tytul"><parm>
75               <xsl:choose>
76                 <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
77                     <!-- title in master -->
78                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/autor_utworu" mode="title" />
79                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/dzielo_nadrzedne" mode="title" />
80                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
81                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
82                     <!-- dc in master or not -->
83                     <cmd name="translatorsline" />
84                 </xsl:when>
85                 <xsl:otherwise>
86                     <!-- look for author title in dc -->
87                     <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
88                     <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='firstdctitle' />
89                 </xsl:otherwise>
90               </xsl:choose>
91             </parm></cmd>
92             <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
93             <xsl:apply-templates select="utwor" mode="part" />
94
95             <TeXML escape="0">
96                 <xsl:if test="@data-cover-by">
97                 \def\coverby{Okładka na podstawie:
98                     <xsl:choose>
99                     <xsl:when test="@data-cover-source">
100                         \href{\datacoversource}{\datacoverby}
101                     </xsl:when>
102                     <xsl:otherwise>
103                         \datacoverby{}
104                     </xsl:otherwise>
105                     </xsl:choose>
106                 }
107                 </xsl:if>
108                 \def\editors{<TeXML escape="1"><xsl:call-template name="editors" /></TeXML>}
109                 <xsl:if test="@funders">
110                     \def\funders{Publikację wsparli i wsparły:
111                         <TeXML escape="1"><xsl:value-of select="@funders" /></TeXML>.}
112                 </xsl:if>
113
114                 <xsl:if test="@sponsor-note|data-sponsor">
115                     \def\sponsors{
116                         \scriptsize
117                         <xsl:choose>
118                             <xsl:when test="@sponsor-note">
119                                 <TeXML escape="1"><xsl:value-of select="@sponsor-note" /></TeXML>
120                             </xsl:when>
121                             <xsl:otherwise>
122                                 Sfinansowano ze~środków:
123                             </xsl:otherwise>
124                         </xsl:choose>
125
126                         \vspace{1em}
127
128                         <xsl:apply-templates select="data-sponsor" mode="sponsor" />
129                     }
130                 </xsl:if>
131             </TeXML>
132
133             <cmd name="editorialsection" />
134
135         </env>
136     </TeXML>
137 </xsl:template>
138
139 <xsl:template match="utwor" mode="part">
140     <cmd name="tytul"><parm>
141       <xsl:choose>
142         <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
143             <!-- title in master -->
144             <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
145             <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
146         </xsl:when>
147         <xsl:otherwise>
148             <!-- look for title in dc -->
149             <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
150             <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='dctitle' />
151         </xsl:otherwise>
152       </xsl:choose>
153     </parm></cmd>
154
155     <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
156     <xsl:apply-templates select="utwor" mode="part" />
157 </xsl:template>
158
159 <!-- =================== -->
160 <!-- = MAIN TITLE PAGE = -->
161 <!-- = (from DC)       = -->
162 <!-- =================== -->
163
164 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="titlepage">
165     <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
166 </xsl:template>
167
168 <xsl:template match="rdf:RDF" mode="titlepage">
169     <TeXML escape="0">
170         \def\authors{<TeXML escape="1"><xsl:call-template name="authors" /></TeXML>}
171         \author{\authors}
172         \title{<TeXML escape="1"><xsl:apply-templates select=".//dc:title" mode="inline" /></TeXML>}
173         \def\translatorsline{<TeXML escape="1"><xsl:call-template name="translators" /></TeXML>}
174
175         \def\bookurl{<TeXML escape="1"><xsl:value-of select=".//dc:identifier.url" /></TeXML>}
176
177         \def\rightsinfo{Ten utwór nie jest objęty majątkowym prawem autorskim i~znajduje się w~domenie
178             publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować
179             i~rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami
180             (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to
181             te dodatkowe materiały udostępnione są na licencji
182             \href{http://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons
183             Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL}.}
184         <xsl:if test=".//dc:rights.license">
185             \def\rightsinfo{Ten utwór jest udostępniony na licencji
186             \href{<xsl:value-of select=".//dc:rights.license" />}{<TeXML escape="1"><xsl:apply-templates select=".//dc:rights" mode="inline" /></TeXML>}.}
187         </xsl:if>
188
189         \def\sourceinfo{
190             <xsl:if test=".//dc:source">
191                 Tekst opracowany na podstawie: <TeXML escape="1"><xsl:apply-templates select=".//dc:source" mode="inline" /></TeXML>
192                 \vspace{.6em}
193             </xsl:if>}
194         \def\publisherinfo{
195             <xsl:if test=".//dc:publisher">
196                 Wydawca:
197                 <TeXML escape="1">
198                     <xsl:for-each select=".//dc:publisher/text()">
199                         <xsl:value-of select="."/>
200                         <xsl:if test="not(position() = last())">, </xsl:if>
201                     </xsl:for-each>
202                 </TeXML>
203                 \vspace{.6em}
204             </xsl:if>}
205         \def\description{<TeXML escape="1"><xsl:apply-templates select=".//dc:description" mode="inline" /></TeXML>}
206         <xsl:if test=".//meta[@id='pdf-id']">
207             <xsl:variable name="isbn" select=".//meta[@id='pdf-id']"/>
208             \def\isbn{ISBN <xsl:value-of select="substring-after($isbn, 'ISBN-')"/>}
209         </xsl:if>
210     </TeXML>
211 </xsl:template>
212
213
214 <!-- ============== -->
215 <!-- = BOOK TITLE = -->
216 <!-- = (from DC)  = -->
217 <!-- ============== -->
218
219 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="dctitle">
220     <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
221 </xsl:template>
222
223 <xsl:template match="rdf:RDF" mode="dctitle">
224     <cmd name="nazwapodutworu"><parm>
225         <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
226     </parm></cmd>
227 </xsl:template>
228
229 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="firstdctitle">
230     <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
231 </xsl:template>
232
233 <xsl:template match="rdf:RDF" mode="firstdctitle">
234     <cmd name="autorutworu"><parm><cmd name="authors"/></parm></cmd>
235     <cmd name="nazwautworu"><parm>
236         <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
237     </parm></cmd>
238     <cmd name="translatorsline" />
239 </xsl:template>
240
241
242 <!-- ============================================================================== -->
243 <!-- = MASTER TAG                                                                 = -->
244 <!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
245 <!-- ============================================================================== -->
246 <!-- ==================================================================================== -->
247 <!-- = BLOCK TAGS                                                                       = -->
248 <!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
249 <!-- ==================================================================================== -->
250
251 <xsl:template
252     match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny|nota|dedykacja|dlugi_cytat|poezja_cyt|motto">
253     <cmd>
254         <xsl:attribute name="name">
255             <xsl:value-of select="wl:texcommand(name())" />
256         </xsl:attribute>
257         <parm><xsl:apply-templates/></parm>
258     </cmd>
259 </xsl:template>
260
261 <xsl:template match="lista_osob">
262     <cmd name="listaosob">
263         <parm><xsl:apply-templates select="naglowek_listy" /></parm>
264         <parm><xsl:apply-templates select="lista_osoba" /></parm>
265     </cmd>
266 </xsl:template>
267
268 <xsl:template match="kwestia">
269     <cmd name="kwestia">
270         <parm><xsl:apply-templates select="strofa|akap|didaskalia" /></parm>
271     </cmd>
272 </xsl:template>
273
274 <xsl:template match="ilustr">
275     <cmd name="ilustr">
276         <parm><xsl:value-of select="@src" /></parm>
277         <parm><xsl:value-of select="@alt" /></parm>
278     </cmd>
279 </xsl:template>
280
281 <!-- ========================================== -->
282 <!-- = PARAGRAPH TAGS                         = -->
283 <!-- = (can contain inline and special tags)  = -->
284 <!-- ========================================== -->
285
286 <!-- only in root -->
287 <xsl:template
288     match="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul"
289     mode="title">
290     <cmd>
291         <xsl:attribute name="name">
292             <xsl:value-of select="wl:texcommand(name())" />
293         </xsl:attribute>
294         <parm><xsl:apply-templates mode="inline"/></parm>
295     </cmd>
296 </xsl:template>
297
298
299 <xsl:template
300     match="naglowek_akt|naglowek_czesc|srodtytul|naglowek_osoba|naglowek_podrozdzial|naglowek_scena|naglowek_rozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy">
301     <cmd>
302         <xsl:attribute name="name">
303             <xsl:value-of select="wl:texcommand(name())" />
304         </xsl:attribute>
305         <parm><xsl:apply-templates mode="inline"/></parm>
306     </cmd>
307 </xsl:template>
308
309 <xsl:template match="strofa" mode="inline">
310     <env name="minipage">
311         <parm><cmd name="linewidth" /></parm>
312         <parm><xsl:apply-templates select="." /></parm>
313     </env>
314 </xsl:template>
315
316 <xsl:template match="strofa">
317   <cmd name="strofa"><parm>
318     <xsl:choose>
319         <xsl:when test="count(br) > 0">
320             <xsl:call-template name="verse">
321                 <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
322                 <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd' or name() = 'wers_do_prawej'][1]" />
323             </xsl:call-template>
324             <xsl:for-each select="br">
325                 <TeXML escape="0">\\{}</TeXML>
326                 <!-- Each BR tag "consumes" text after it -->
327                 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
328                 <xsl:call-template name="verse">
329                     <xsl:with-param name="verse-content"
330                         select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
331                     <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' or name() = 'wers_do_prawej')][1]" />
332                 </xsl:call-template>
333             </xsl:for-each>
334         </xsl:when>
335         <xsl:otherwise>
336             <xsl:call-template name="verse">
337                 <xsl:with-param name="verse-content" select="text() | node()" />
338                 <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd|wers_do_prawej[1]" />
339             </xsl:call-template>
340         </xsl:otherwise>
341     </xsl:choose>
342   </parm></cmd>
343 </xsl:template>
344
345
346 <xsl:template name="verse">
347     <xsl:param name="verse-content" />
348     <xsl:param name="verse-type" />
349
350     <cmd>
351         <xsl:attribute name="name">
352             <xsl:choose>
353                 <xsl:when test="$verse-type != ''">
354                     <xsl:value-of select='wl:texcommand(name($verse-type))' />
355                 </xsl:when>
356                 <xsl:otherwise>wers</xsl:otherwise>
357             </xsl:choose>
358         </xsl:attribute>
359         <xsl:if test="string($verse-content/@typ)">
360             <opt><xsl:value-of select="$verse-content/@typ" />em</opt>
361         </xsl:if>
362         <parm><xsl:apply-templates select="$verse-content" mode="inline"/></parm>
363     </cmd>
364 </xsl:template>
365
366 <!-- ================================================ -->
367 <!-- = INLINE TAGS                                  = -->
368 <!-- = (contain other inline tags and special tags) = -->
369 <!-- ================================================ -->
370
371 <xsl:template mode="inline"
372     match="pa|pe|pr|pt|mat|didask_tekst|slowo_obce|wyroznienie|osoba|indeks_dolny|wieksze_odstepy">
373     <cmd>
374         <xsl:attribute name="name">
375             <xsl:value-of select="wl:texcommand(name())" />
376         </xsl:attribute>
377         <parm><xsl:apply-templates mode="inline"/></parm>
378     </cmd>
379 </xsl:template>
380
381
382
383 <xsl:template match="tytul_dziela" mode="inline">
384     <cmd name="tytuldziela"><parm>
385         <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
386     </parm></cmd>
387 </xsl:template>
388
389
390
391 <!-- ============================================== -->
392 <!-- = STANDALONE TAGS                            = -->
393 <!-- = (cannot contain any other tags)            = -->
394 <!-- ============================================== -->
395 <xsl:template
396     match="sekcja_swiatlo|sekcja_asterysk|separator_linia">
397     <cmd>
398         <xsl:attribute name="name">
399             <xsl:value-of select="wl:texcommand(name())" />
400         </xsl:attribute>
401     </cmd>
402 </xsl:template>
403
404
405 <!-- ================ -->
406 <!-- = SPECIAL TAGS = -->
407 <!-- ================ -->
408 <!-- Themes -->
409
410
411 <xsl:template match="begin|end|motyw">
412     <xsl:apply-templates select='.' mode="inline" />
413 </xsl:template>
414
415 <xsl:template match="begin" mode="inline" />
416 <xsl:template match="end" mode="inline" />
417
418 <xsl:template match="motyw" mode="inline">
419     <cmd name="motyw">
420         <xsl:if test="@moved">
421             <opt name="moved"><xsl:value-of select="@moved" /></opt>
422         </xsl:if>
423         <parm><xsl:apply-templates mode="inline" /></parm>
424     </cmd>
425 </xsl:template>
426
427 <xsl:template name="authors">
428     <xsl:for-each select=".//dc:creator_parsed">
429         <xsl:if test="position() != 1">, </xsl:if>
430         <xsl:apply-templates mode="inline" />
431     </xsl:for-each>
432 </xsl:template>
433
434 <xsl:template name="editors">
435     <xsl:if test="@editors">
436         <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>
437         <xsl:value-of select="@editors" />
438         <xsl:text>.</xsl:text>
439     </xsl:if>
440 </xsl:template>
441
442 <xsl:template name="translators">
443     <xsl:if test=".//dc:contributor.translator_parsed">
444         <cmd name='translator'><parm>
445             <xsl:for-each select=".//dc:contributor.translator_parsed">
446                 <xsl:if test="position() != 1">, </xsl:if>
447                 <xsl:apply-templates mode="inline" />
448             </xsl:for-each>
449         </parm></cmd>
450     </xsl:if>
451 </xsl:template>
452
453 <xsl:template match="data-sponsor" mode="sponsor">
454     <cmd name="par"><parm>
455     <xsl:choose>
456         <xsl:when test="@src">
457             \includegraphics[height=0.25\textwidth,width=0.25\textwidth,keepaspectratio]{<xsl:value-of select="@src" />}
458         </xsl:when>
459         <xsl:otherwise>
460             <xsl:value-of select="@name" />
461         </xsl:otherwise>
462     </xsl:choose>
463     </parm></cmd>
464 </xsl:template>
465
466 <xsl:template match="mat" mode="inline">
467     <TeXML escape="0">
468         <xsl:text>$</xsl:text>
469         <xsl:value-of select="wl:mathml_latex(.)" />
470         <xsl:text>$</xsl:text>
471     </TeXML>
472 </xsl:template>
473
474 <xsl:template match="mat">
475     <TeXML escape="0">
476         <xsl:text>$$</xsl:text>
477         <xsl:value-of select="wl:mathml_latex(.)" />
478         <xsl:text>$$</xsl:text>
479     </TeXML>
480 </xsl:template>
481
482 <xsl:template match="tabela|tabelka">
483     <cmd name="par" />
484     <cmd name="vspace"><parm>1em</parm></cmd>
485     <group><cmd name="raggedright" />
486     <xsl:element name="env">
487         <xsl:attribute name="name">
488             <xsl:choose>
489                 <xsl:when test="name(.)='tabela'">longtabu</xsl:when>
490                 <xsl:otherwise>tabu</xsl:otherwise>
491             </xsl:choose>
492         </xsl:attribute> to <TeXML escape="0">\textwidth </TeXML>
493       <!--parm><cmd name="textwidth"/></parm-->
494       <parm><TeXML escape="0"><xsl:value-of select="@_format" /></TeXML></parm>
495         <xsl:choose>
496         <xsl:when test="@ramka='1' or @ramki='1'">
497           <cmd name="hline" />
498           <xsl:apply-templates mode="wiersze-ramki"/>
499         </xsl:when>
500         <xsl:otherwise>
501           <xsl:apply-templates/>
502         </xsl:otherwise>
503         </xsl:choose>
504     </xsl:element>
505     </group>
506     <cmd name="vspace"><parm>1em</parm></cmd>
507 </xsl:template>
508 <xsl:template match="wiersz" mode="wiersze-ramki">
509     <xsl:apply-templates />
510     <spec cat="esc"/><spec cat="esc"/>
511     <cmd name="hline" gr="0" />
512 </xsl:template>
513 <xsl:template match="wiersz">
514     <xsl:apply-templates />
515     <spec cat="esc"/><spec cat="esc"/>
516 </xsl:template>
517 <xsl:template match="kol">
518     <xsl:apply-templates mode="inline"/>
519     <xsl:if test="position() &lt; last()">
520     <spec cat="align"/>
521     </xsl:if>
522 </xsl:template>
523
524
525 <!-- ============== -->
526 <!-- = ADDED TAGS = -->
527 <!-- ============== -->
528
529
530 <xsl:template match="dywiz" mode="inline">
531     <cmd name="dywiz" />
532 </xsl:template>
533
534 <xsl:template match="nbsp" mode="inline">
535     <spec cat="tilde" />
536 </xsl:template>
537
538 <xsl:template match="alien" mode="inline">
539     <group>
540         <cmd name="alien" />
541         <xsl:apply-templates mode="inline" />
542     </group>
543 </xsl:template>
544
545 <!-- ================ -->
546 <!-- = IGNORED TAGS = -->
547 <!-- ================ -->
548 <xsl:template match="extra|uwaga" />
549 <xsl:template match="extra|uwaga" mode="inline" />
550
551 <xsl:template match="nota_red" />
552 <xsl:template match="abstrakt" />
553
554 <!-- ======== -->
555 <!-- = TEXT = -->
556 <!-- ======== -->
557 <xsl:template match="text()" />
558 <xsl:template match="text()" mode="inline">
559     <xsl:if test="preceding-sibling::node() and wl:starts_white(.)">
560       <xsl:text> </xsl:text>
561     </xsl:if>
562
563     <xsl:value-of select="wl:substitute_entities(wl:strip(.))" />
564
565     <xsl:if test="following-sibling::node() and wl:ends_white(.)">
566       <xsl:text> </xsl:text>
567     </xsl:if>
568 </xsl:template>
569
570
571 </xsl:stylesheet>