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