Preliminary math and tables support.
[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">
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="motto">
71     <div class="motto" xmlns="http://www.w3.org/1999/xhtml">
72       <xsl:apply-templates />
73     </div>
74   </xsl:template>
75
76   <!--===========================================================-->
77   <!-- Tagi PARAGRAFOWE -->
78   <!--===========================================================-->
79
80   <xsl:template match="autor_utworu" mode="poczatek">
81     <h2 class="author" xmlns="http://www.w3.org/1999/xhtml">
82       <xsl:apply-templates />
83     </h2>
84   </xsl:template>
85
86   <xsl:template match="autor_utworu" />
87
88   <xsl:template match="dzielo_nadrzedne" mode="poczatek">
89     <h2 class="collection" xmlns="http://www.w3.org/1999/xhtml">
90       <xsl:apply-templates />
91     </h2>
92   </xsl:template>
93
94   <xsl:template match="dzielo_nadrzedne" />
95
96   <xsl:template match="nazwa_utworu" mode="poczatek" >
97     <h2 class="intitle" xmlns="http://www.w3.org/1999/xhtml">
98       <xsl:apply-templates />
99     </h2>
100   </xsl:template>
101
102   <xsl:template match="nazwa_utworu" />
103
104   <xsl:template match="podtytul" mode="poczatek">
105     <h2 class="insubtitle" xmlns="http://www.w3.org/1999/xhtml">
106       <xsl:apply-templates />
107     </h2>
108   </xsl:template>
109
110   <xsl:template match="podtytul" />
111
112   <xsl:template match="naglowek_czesc|srodtytul">
113     <h2 class="h2" xmlns="http://www.w3.org/1999/xhtml">
114       <xsl:apply-templates />
115     </h2>
116   </xsl:template>
117
118   <xsl:template match="naglowek_akt">
119     <h2 class="h2" xmlns="http://www.w3.org/1999/xhtml">
120       <xsl:apply-templates />
121     </h2>
122   </xsl:template>
123
124   <xsl:template match="naglowek_scena">
125     <a id="sub{@sub}" xmlns="http://www.w3.org/1999/xhtml"></a>
126     <h2 class="h3" xmlns="http://www.w3.org/1999/xhtml">
127       <xsl:apply-templates />
128     </h2>
129   </xsl:template>
130
131   <xsl:template match="naglowek_podrozdzial">
132     <a id="sub{@sub}" xmlns="http://www.w3.org/1999/xhtml"></a>
133     <h2 class="h4" xmlns="http://www.w3.org/1999/xhtml">
134       <xsl:apply-templates />
135     </h2>
136   </xsl:template>
137
138   <xsl:template match="naglowek_rozdzial">
139     <h2 class="h3" xmlns="http://www.w3.org/1999/xhtml">
140       <xsl:apply-templates />
141     </h2>
142   </xsl:template>
143
144   <xsl:template match="naglowek_osoba">
145     <h2 class="h4" xmlns="http://www.w3.org/1999/xhtml">
146       <xsl:apply-templates />
147     </h2>
148   </xsl:template>
149
150   <xsl:template match="miejsce_czas">
151     <div class="place-and-time" xmlns="http://www.w3.org/1999/xhtml">
152       <xsl:apply-templates />
153     </div>
154   </xsl:template>
155
156   <xsl:template match="didaskalia">
157     <div class="didaskalia" xmlns="http://www.w3.org/1999/xhtml">
158       <xsl:apply-templates />
159     </div>
160   </xsl:template>
161
162   <xsl:template match="akap|akap_dialog|akap_cd">
163     <p class="paragraph" xmlns="http://www.w3.org/1999/xhtml">
164       <xsl:apply-templates />
165     </p>
166   </xsl:template>
167
168   <xsl:template match="strofa">
169     <div class="stanza" xmlns="http://www.w3.org/1999/xhtml">
170       <xsl:apply-templates />
171     </div><div class='stanza-spacer' xmlns="http://www.w3.org/1999/xhtml">&#160;</div>
172   </xsl:template>
173
174   <xsl:template match="wers_normalny">
175     <div class="verse" xmlns="http://www.w3.org/1999/xhtml">
176       <xsl:apply-templates />
177     &#160;</div>
178   </xsl:template>
179
180   <xsl:template match="wers_akap">
181     <div class="verse" style="margin-left: 1em;" xmlns="http://www.w3.org/1999/xhtml">
182       <xsl:apply-templates />
183     &#160;</div>
184   </xsl:template>
185
186   <xsl:template match="wers_wciety">
187     <div class="verse" style='margin-left:1em;' xmlns="http://www.w3.org/1999/xhtml">
188       <xsl:apply-templates />
189     &#160;</div>
190   </xsl:template>
191
192   <xsl:template match="wers_wciety[@typ!='']">
193     <div class="verse" xmlns="http://www.w3.org/1999/xhtml">
194       <xsl:attribute name="style">
195           margin-left: <xsl:value-of select="@typ" />em;
196       </xsl:attribute>
197       <xsl:apply-templates />
198     &#160;</div>
199   </xsl:template>
200
201   <xsl:template match="wers_cd">
202     <div class="verse" style="margin-left: 12em;" xmlns="http://www.w3.org/1999/xhtml">
203       <xsl:apply-templates />
204     &#160;</div>
205   </xsl:template>
206
207   <xsl:template match="motto_podpis">
208     <div class="motto_podpis" xmlns="http://www.w3.org/1999/xhtml">
209       <xsl:apply-templates />
210     </div>
211   </xsl:template>
212
213   <!--===========================================================-->
214   <!-- Tagi LINIOWE -->
215   <!--===========================================================-->
216
217   <xsl:template match="slowo_obce">
218     <em class="foreign-word" xmlns="http://www.w3.org/1999/xhtml">
219       <xsl:apply-templates />
220     </em>
221   </xsl:template>
222
223   <xsl:template match="mat" >
224     <em class="math" xmlns="http://www.w3.org/1999/xhtml">
225       <xsl:apply-templates />
226     </em>
227   </xsl:template>
228
229   <xsl:template match="didask_tekst" >
230     <em class="didaskalia" xmlns="http://www.w3.org/1999/xhtml">
231       <xsl:apply-templates />
232     </em>
233   </xsl:template>
234
235   <xsl:template match="tytul_dziela" >
236     <em class="book-title" xmlns="http://www.w3.org/1999/xhtml">
237       <xsl:if test="@typ = '1'" >„</xsl:if>
238       <xsl:apply-templates />
239       <xsl:if test="@typ = '1'">”</xsl:if>
240     </em>
241   </xsl:template>
242
243   <xsl:template match="wyroznienie" >
244     <em class="author-emphasis" xmlns="http://www.w3.org/1999/xhtml">
245       <xsl:apply-templates />
246     </em>
247   </xsl:template>
248
249   <xsl:template match="osoba" >
250     <em class="person" xmlns="http://www.w3.org/1999/xhtml">
251       <xsl:apply-templates />
252     </em>
253   </xsl:template>
254
255   <xsl:template match="naglowek_listy"  >
256     <xsl:apply-templates />
257   </xsl:template>
258
259   <xsl:template match="lista_osoba" >
260     <li xmlns="http://www.w3.org/1999/xhtml">
261       <xsl:apply-templates />
262     </li>
263   </xsl:template>
264
265   <!--===========================================================-->
266   <!-- Tagi STANDALONE -->
267   <!--===========================================================-->
268
269   <xsl:template match="sekcja_swiatlo">
270     <p class="spacer" xmlns="http://www.w3.org/1999/xhtml">&#160;</p>
271   </xsl:template>
272
273   <xsl:template match="sekcja_asterysk">
274     <p class="spacer-asterisk" xmlns="http://www.w3.org/1999/xhtml">*</p>
275   </xsl:template>
276
277   <xsl:template match="separator_linia">
278     <hr class="spacer-line" xmlns="http://www.w3.org/1999/xhtml"></hr>
279   </xsl:template>
280
281   <!--===========================================================-->
282   <!-- Tagi SPECJALNE -->
283   <!--===========================================================-->
284
285   <xsl:template match="motyw" />
286
287 <xsl:template match="mat">
288     <img xmlns="http://www.w3.org/1999/xhtml">
289         <xsl:attribute name="src">
290             <xsl:value-of select="wl:mathml(.)" />
291         </xsl:attribute>
292     </img>
293 </xsl:template>
294
295 <xsl:template match="tabela">
296   <table xmlns="http://www.w3.org/1999/xhtml">
297     <xsl:apply-templates />
298   </table>
299 </xsl:template>
300 <xsl:template match="wiersz">
301   <tr xmlns="http://www.w3.org/1999/xhtml">
302       <xsl:apply-templates />
303   </tr>
304 </xsl:template>
305 <xsl:template match="kol">
306   <td xmlns="http://www.w3.org/1999/xhtml">
307      <xsl:apply-templates />
308   </td>
309 </xsl:template>
310
311
312   <!--===========================================================-->
313   <!-- Tagi IGNOROWANE -->
314   <!--===========================================================-->
315
316   <xsl:template match="extra" />
317
318   <xsl:template match="pe|pa|pr|pt" >
319     <a class="anchor" id="anchor-{.}" href="annotations.html#annotation-{.}"
320        xmlns="http://www.w3.org/1999/xhtml"><sup xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></sup></a>
321   </xsl:template>
322
323   <xsl:template match="uwaga" />
324
325   <xsl:template match="nota_red" />
326
327   <!--pominięcie tych metadanych-->
328   <xsl:template match="rdf:RDF" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" />
329
330   <!--===========================================================-->
331   <!-- Tagi TEKSTOWE -->
332   <!--===========================================================-->
333
334   <xsl:template match="text()"  >
335     <xsl:value-of select="." />
336   </xsl:template>
337
338   <xsl:template match="text()" >
339     <xsl:value-of select="." />
340   </xsl:template>
341
342 </xsl:stylesheet>