fix children books in toc
[librarian.git] / librarian / fb2 / fb2.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="http://www.gribuser.ru/xml/fictionbook/2.0"
12         xmlns:l="http://www.w3.org/1999/xlink">
13
14         <xsl:include href="description.xslt"/>
15         <xsl:include href="footnotes.xslt"/>
16         <xsl:include href="inline.xslt"/>
17         <xsl:include href="paragraphs.xslt"/>
18         <xsl:include href="poems.xslt"/>
19         <xsl:include href="sections.xslt"/>
20         <xsl:include href="drama.xslt"/>
21
22         <xsl:strip-space elements="*"/>
23         <xsl:output encoding="utf-8" method="xml" indent="yes"/>
24
25         <xsl:template match="utwor">
26                 <FictionBook>
27                         <xsl:apply-templates mode="outer"/>
28
29                         <body name="notes">
30                                 <xsl:apply-templates mode="footnotes"/>
31                         </body>
32                 </FictionBook>
33         </xsl:template>
34
35         <!-- we can't handle lyrics nicely yet -->
36         <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp" mode="outer">
37                 <body> <!-- main body for main book flow -->
38                         <xsl:if test="autor_utworu or nazwa_utworu">
39                                 <title>
40                                         <xsl:apply-templates mode="title"
41                                                 select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul"/>
42                     <xsl:call-template name="translators" />
43                                 </title>
44                         </xsl:if>
45
46                         <epigraph>
47                                 <p>
48                                         Utwór opracowany został w&#160;ramach projektu
49                                                 <a l:href="http://www.wolnelektury.pl/">Wolne Lektury</a>
50                                         przez <a l:href="http://www.nowoczesnapolska.org.pl/">fundację
51                                                 Nowoczesna Polska</a>.
52                                 </p>
53                         </epigraph>
54
55                         <xsl:call-template name="section" />
56                 </body>
57         </xsl:template>
58
59         <xsl:template match="uwaga" mode="outer"/>
60         <xsl:template match="extra" mode="outer"/>
61
62         <xsl:template mode="title" match="*">
63                 <!-- title -->
64
65                 <p><xsl:apply-templates mode="inline"/></p>
66         </xsl:template>
67
68     <xsl:template name="translators">
69         <xsl:if test="//dc:contributor.translator">
70             <p>
71                 <xsl:text>tłum. </xsl:text>
72                 <xsl:for-each select="//dc:contributor.translator">
73                     <xsl:if test="position() != 1">, </xsl:if>
74                     <xsl:apply-templates mode="person" />
75                 </xsl:for-each>
76             </p>
77         </xsl:if>
78     </xsl:template>
79
80     <xsl:template match="text()" mode="person">
81         <xsl:value-of select="wl:person_name(.)" />
82     </xsl:template>
83
84
85         <xsl:template match="uwaga" mode="title"/>
86         <xsl:template match="extra" mode="title"/>
87 </xsl:stylesheet>