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