New EPUB builder, other minor changes.
[librarian.git] / src / librarian / epub / xsltScheme.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0"  xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:wl="http://wolnelektury.pl/functions" exclude-result-prefixes="mml wl">
3   <xsl:output method="html" version="1.0" encoding="utf-8" />
4
5   <xsl:template match="/" >
6     <xsl:element name="html" xmlns="http://www.w3.org/1999/xhtml">
7       <xsl:element name="head">
8         <link rel="stylesheet" href="style.css" type="text/css" />
9         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10         <title>WolneLektury.pl</title>
11       </xsl:element>
12       <xsl:element name="body" xmlns="http://www.w3.org/1999/xhtml">
13         <xsl:element name="div" xmlns="http://www.w3.org/1999/xhtml">
14           <xsl:attribute name="id">book-text</xsl:attribute>
15           <xsl:if test="//nazwa_utworu">
16             <!--h1 xmlns="http://www.w3.org/1999/xhtml"-->
17               <xsl:apply-templates select=" //nazwa_utworu" mode="poczatek"/>
18               <xsl:apply-templates select=" //podtytul" mode="poczatek"/>
19             <!--/h1-->
20           </xsl:if>
21           <xsl:apply-templates />
22         </xsl:element>
23       </xsl:element>
24     </xsl:element>
25   </xsl:template>
26
27   <!--===========================================================-->
28   <!-- Tagi BLOKOWE -->
29   <!--===========================================================-->
30
31   <xsl:template match="nota">
32     <div class="note" xmlns="http://www.w3.org/1999/xhtml">
33       <xsl:apply-templates />
34     </div>
35   </xsl:template>
36
37   <xsl:template match="lista_osob" >
38     <div class="person-list" xmlns="http://www.w3.org/1999/xhtml">
39       <div class="h3" xmlns="http://www.w3.org/1999/xhtml">
40         <xsl:apply-templates select="child::naglowek_listy" />
41       </div>
42       <ol xmlns="http://www.w3.org/1999/xhtml">
43         <xsl:apply-templates select="lista_osoba" />
44       </ol>
45     </div>
46   </xsl:template>
47
48   <xsl:template match="dedykacja">
49     <div class="dedication" xmlns="http://www.w3.org/1999/xhtml">
50       <xsl:apply-templates />
51     </div>
52   </xsl:template>
53
54   <xsl:template match="kwestia">
55     <div class="kwestia" xmlns="http://www.w3.org/1999/xhtml">
56       <xsl:apply-templates select="strofa|akapit|didaskalia|akap " />
57     </div>
58   </xsl:template>
59
60   <xsl:template match="dlugi_cytat|poezja_cyt">
61     <div class="block" xmlns="http://www.w3.org/1999/xhtml">
62       <xsl:apply-templates />
63     </div>
64   </xsl:template>
65
66   <xsl:template match="ramka">
67     <div class="frame" xmlns="http://www.w3.org/1999/xhtml">
68       <xsl:apply-templates />
69     </div>
70   </xsl:template>
71
72   <xsl:template match="motto">
73     <div class="motto" xmlns="http://www.w3.org/1999/xhtml">
74       <xsl:apply-templates />
75     </div>
76   </xsl:template>
77
78   <xsl:template match="ilustr">
79     <img>
80       <xsl:attribute name="alt">
81         <xsl:value-of select="@alt" />
82       </xsl:attribute>
83       <xsl:attribute name="src">
84         <xsl:value-of select="@src" />
85       </xsl:attribute>
86       <xsl:attribute name="title">
87         <xsl:value-of select="@alt" />
88       </xsl:attribute>
89     </img>
90   </xsl:template>
91
92   <!--===========================================================-->
93   <!-- Tagi PARAGRAFOWE -->
94   <!--===========================================================-->
95
96   <xsl:template match="autor_utworu" mode="poczatek">
97     <h2 class="author" xmlns="http://www.w3.org/1999/xhtml">
98       <xsl:apply-templates />
99     </h2>
100   </xsl:template>
101
102   <xsl:template match="autor_utworu" />
103
104   <xsl:template match="dzielo_nadrzedne" mode="poczatek">
105     <h2 class="collection" xmlns="http://www.w3.org/1999/xhtml">
106       <xsl:apply-templates />
107     </h2>
108   </xsl:template>
109
110   <xsl:template match="dzielo_nadrzedne" />
111
112   <xsl:template match="nazwa_utworu" mode="poczatek" >
113     <h2 class="intitle" xmlns="http://www.w3.org/1999/xhtml">
114       <xsl:apply-templates />
115     </h2>
116   </xsl:template>
117
118   <xsl:template match="nazwa_utworu" />
119
120   <xsl:template match="podtytul" mode="poczatek">
121     <h2 class="insubtitle" xmlns="http://www.w3.org/1999/xhtml">
122       <xsl:apply-templates />
123     </h2>
124   </xsl:template>
125
126   <xsl:template match="podtytul" />
127
128   <xsl:template match="naglowek_czesc|srodtytul">
129     <h2 class="h2" xmlns="http://www.w3.org/1999/xhtml">
130       <xsl:apply-templates />
131     </h2>
132   </xsl:template>
133
134   <xsl:template match="naglowek_akt">
135     <h2 class="h2" xmlns="http://www.w3.org/1999/xhtml">
136       <xsl:apply-templates />
137     </h2>
138   </xsl:template>
139
140   <xsl:template match="naglowek_scena">
141     <a id="sub{@sub}" xmlns="http://www.w3.org/1999/xhtml"><xsl:comment/><!-- hack to keep closing tags --></a>
142     <h2 class="h3" xmlns="http://www.w3.org/1999/xhtml">
143       <xsl:apply-templates />
144     </h2>
145   </xsl:template>
146
147   <xsl:template match="naglowek_podrozdzial">
148     <a id="sub{@sub}" xmlns="http://www.w3.org/1999/xhtml"><xsl:comment/><!-- same as above --></a>
149     <h2 class="h4" xmlns="http://www.w3.org/1999/xhtml">
150       <xsl:apply-templates />
151     </h2>
152   </xsl:template>
153
154   <xsl:template match="naglowek_rozdzial">
155     <h2 class="h3" xmlns="http://www.w3.org/1999/xhtml">
156       <xsl:apply-templates />
157     </h2>
158   </xsl:template>
159
160   <xsl:template match="podtytul_czesc|podtytul_akt">
161     <h2 class="h2"><small>
162       <xsl:apply-templates />
163     </small></h2>
164   </xsl:template>
165
166   <xsl:template match="podtytul_rozdzial|podtytul_scena">
167     <h2 class="h3"><small>
168       <xsl:apply-templates />
169     </small></h2>
170   </xsl:template>
171
172   <xsl:template match="podtytul_podrozdzial">
173     <h2 class="h4"><small>
174       <xsl:apply-templates />
175     </small></h2>
176   </xsl:template>
177
178
179   <xsl:template match="naglowek_osoba">
180     <h2 class="h4" xmlns="http://www.w3.org/1999/xhtml">
181       <xsl:apply-templates />
182     </h2>
183   </xsl:template>
184
185   <xsl:template match="miejsce_czas">
186     <div class="place-and-time" xmlns="http://www.w3.org/1999/xhtml">
187       <xsl:apply-templates />
188     </div>
189   </xsl:template>
190
191   <xsl:template match="didaskalia">
192     <div class="didaskalia" xmlns="http://www.w3.org/1999/xhtml">
193       <xsl:apply-templates />
194     </div>
195   </xsl:template>
196
197   <xsl:template match="akap|akap_dialog|akap_cd">
198     <p class="paragraph" xmlns="http://www.w3.org/1999/xhtml">
199       <xsl:apply-templates />
200     </p>
201   </xsl:template>
202
203   <xsl:template match="strofa">
204     <div class="stanza" xmlns="http://www.w3.org/1999/xhtml">
205       <xsl:apply-templates />
206     </div><div class='stanza-spacer' xmlns="http://www.w3.org/1999/xhtml">&#160;</div>
207   </xsl:template>
208
209   <xsl:template match="wers_normalny">
210     <div class="verse" xmlns="http://www.w3.org/1999/xhtml">
211       <xsl:apply-templates />
212     &#160;</div>
213   </xsl:template>
214
215   <xsl:template match="wers_akap">
216     <div class="verse" style="margin-left: 1em;" xmlns="http://www.w3.org/1999/xhtml">
217       <xsl:apply-templates />
218     &#160;</div>
219   </xsl:template>
220
221   <xsl:template match="wers_wciety">
222     <div class="verse" style='margin-left:1em;' xmlns="http://www.w3.org/1999/xhtml">
223       <xsl:apply-templates />
224     &#160;</div>
225   </xsl:template>
226
227   <xsl:template match="wers_do_prawej">
228     <div class="verse" style='text-align: right;' xmlns="http://www.w3.org/1999/xhtml">
229       <xsl:apply-templates/>
230     &#160;</div>
231   </xsl:template>
232
233   <xsl:template match="wers_wciety[@typ!='']">
234     <div class="verse" xmlns="http://www.w3.org/1999/xhtml">
235       <xsl:attribute name="style">
236           margin-left: <xsl:value-of select="@typ" />em;
237       </xsl:attribute>
238       <xsl:apply-templates />
239     &#160;</div>
240   </xsl:template>
241
242   <xsl:template match="wers_cd">
243     <div class="verse" style="margin-left: 12em;" xmlns="http://www.w3.org/1999/xhtml">
244       <xsl:apply-templates />
245     &#160;</div>
246   </xsl:template>
247
248   <xsl:template match="motto_podpis">
249     <div class="motto_podpis" xmlns="http://www.w3.org/1999/xhtml">
250       <xsl:apply-templates />
251     </div>
252   </xsl:template>
253
254   <!--===========================================================-->
255   <!-- Tagi LINIOWE -->
256   <!--===========================================================-->
257
258   <xsl:template match="slowo_obce">
259     <em class="foreign-word" xmlns="http://www.w3.org/1999/xhtml">
260       <xsl:apply-templates />
261     </em>
262   </xsl:template>
263
264   <xsl:template match="mat" >
265     <em class="math" xmlns="http://www.w3.org/1999/xhtml">
266       <xsl:apply-templates />
267     </em>
268   </xsl:template>
269
270   <xsl:template match="didask_tekst" >
271     <em class="didaskalia" xmlns="http://www.w3.org/1999/xhtml">
272       <xsl:apply-templates />
273     </em>
274   </xsl:template>
275
276   <xsl:template match="tytul_dziela" >
277     <em class="book-title" xmlns="http://www.w3.org/1999/xhtml">
278       <xsl:if test="@typ = '1'" >„</xsl:if>
279       <xsl:apply-templates />
280       <xsl:if test="@typ = '1'">”</xsl:if>
281     </em>
282   </xsl:template>
283
284   <xsl:template match="wyroznienie" >
285     <em class="author-emphasis" xmlns="http://www.w3.org/1999/xhtml">
286       <xsl:apply-templates />
287     </em>
288   </xsl:template>
289
290   <xsl:template match="wieksze_odstepy" >
291     <em class="wieksze-odstepy" xmlns="http://www.w3.org/1999/xhtml">
292       <xsl:apply-templates />
293     </em>
294   </xsl:template>
295
296   <xsl:template match="indeks_dolny" >
297     <sub xmlns="http://www.w3.org/1999/xhtml">
298       <xsl:apply-templates />
299     </sub>
300   </xsl:template>
301
302   <xsl:template match="osoba" >
303     <em class="person" xmlns="http://www.w3.org/1999/xhtml">
304       <xsl:apply-templates />
305     </em>
306   </xsl:template>
307
308   <xsl:template match="naglowek_listy"  >
309     <xsl:apply-templates />
310   </xsl:template>
311
312   <xsl:template match="lista_osoba" >
313     <li xmlns="http://www.w3.org/1999/xhtml">
314       <xsl:apply-templates />
315     </li>
316   </xsl:template>
317
318   <!--===========================================================-->
319   <!-- Tagi STANDALONE -->
320   <!--===========================================================-->
321
322   <xsl:template match="sekcja_swiatlo">
323     <p class="spacer" xmlns="http://www.w3.org/1999/xhtml">&#160;</p>
324   </xsl:template>
325
326   <xsl:template match="sekcja_asterysk">
327     <p class="spacer-asterisk" xmlns="http://www.w3.org/1999/xhtml">*</p>
328   </xsl:template>
329
330   <xsl:template match="separator_linia">
331     <hr class="spacer-line" xmlns="http://www.w3.org/1999/xhtml"></hr>
332   </xsl:template>
333
334   <!--===========================================================-->
335   <!-- Tagi SPECJALNE -->
336   <!--===========================================================-->
337
338   <xsl:template match="motyw" />
339
340 <xsl:template match="mat">
341     <img xmlns="http://www.w3.org/1999/xhtml">
342         <xsl:attribute name="src">
343             <xsl:value-of select="wl:mathml(.)" />
344         </xsl:attribute>
345     </img>
346 </xsl:template>
347
348 <xsl:template match="tabela|tabelka">
349     <xsl:choose>
350         <xsl:when test="@ramka = '1'">
351             <table class="border" xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></table>
352         </xsl:when>
353         <xsl:otherwise>
354             <table xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></table>
355         </xsl:otherwise>
356     </xsl:choose>
357 </xsl:template>
358 <xsl:template match="wiersz">
359   <tr xmlns="http://www.w3.org/1999/xhtml">
360       <xsl:apply-templates />
361   </tr>
362 </xsl:template>
363 <xsl:template match="kol">
364   <td xmlns="http://www.w3.org/1999/xhtml">
365      <xsl:apply-templates />
366   </td>
367 </xsl:template>
368
369
370   <!--===========================================================-->
371   <!-- Tagi IGNOROWANE -->
372   <!--===========================================================-->
373
374   <xsl:template match="extra" />
375
376   <xsl:template match="pe|pa|pr|pt" >
377     <a class="anchor" href="annotations.xhtml#annotation-{.}" id="anchor-{.}"
378        xmlns="http://www.w3.org/1999/xhtml"><sup xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></sup></a>
379   </xsl:template>
380
381   <xsl:template match="uwaga" />
382
383   <xsl:template match="nota_red" />
384   <xsl:template match="abstrakt" />
385
386   <!--pominięcie tych metadanych-->
387   <xsl:template match="rdf:RDF" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" />
388
389   <!--===========================================================-->
390   <!-- Tagi TEKSTOWE -->
391   <!--===========================================================-->
392
393   <xsl:template match="text()"  >
394     <xsl:value-of select="." />
395   </xsl:template>
396
397   <xsl:template match="text()" >
398     <xsl:value-of select="." />
399   </xsl:template>
400
401 </xsl:stylesheet>