fix for newlines in epub
[librarian.git] / librarian / epub / xsltLast.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3     xmlns="http://www.w3.org/1999/xhtml"
4     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5     xmlns:dc="http://purl.org/dc/elements/1.1/"
6     xmlns:wl="http://wolnelektury.pl/functions"
7     xmlns:date="http://exslt.org/dates-and-times">
8   <xsl:output method="html" version="1.0" encoding="utf-8" />
9   <xsl:output doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
10   <xsl:output doctype-public="-//W3C//DTD XHTML 1.1//EN" />
11   <xsl:param name="outputtype"/>
12
13   <xsl:template match="utwor">
14     <html>
15       <head>
16         <link rel="stylesheet" href="style.css" type="text/css" />
17         <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
18         <title>
19           <xsl:text>Strona redakcyjna</xsl:text>
20         </title>
21       </head>
22       <body>
23         <div id="book-text" >
24           <p class="info">
25               <xsl:choose>
26                   <xsl:when test="//dc:rights.license">
27                       Ten utwór jest udostępniony na licencji
28                       <a>
29                           <xsl:attribute name="href">
30                               <xsl:value-of select="//dc:rights.license" />
31                           </xsl:attribute>
32                           <xsl:value-of select="//dc:rights" />
33                       </a>
34                   </xsl:when>
35                   <xsl:otherwise>
36                     Ten utwór nie jest objęty majątkowym prawem autorskim i znajduje się w domenie
37                     publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować
38                     i rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami
39                     (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to
40                     te dodatkowe materiały udostępnione są na licencji
41                     <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
42                     Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL</a>.
43                   </xsl:otherwise>
44               </xsl:choose>
45           </p>
46
47           <p class="info">Źródło: <a>
48               <xsl:attribute name="href">
49                   <xsl:value-of select="//dc:identifier.url" />
50               </xsl:attribute>
51               <xsl:attribute name="title">
52                   <xsl:for-each select="//dc:creator/text()"><xsl:value-of select="wl:person_name(.)"/>, </xsl:for-each><xsl:value-of select="//dc:title" />
53               </xsl:attribute>
54               <xsl:value-of select="//dc:identifier.url" />
55           </a></p>
56
57           <xsl:if test="//dc:source" >
58             <p class="info">Tekst opracowany na podstawie: <xsl:value-of select="//dc:source" /></p>
59           </xsl:if>
60
61           <xsl:if test="//dc:publisher">
62             <p class="info">
63               Wydawca:
64               <xsl:for-each select="//dc:publisher/text()">
65                 <xsl:value-of select="."/>
66                 <xsl:if test="not(position() = last())">, </xsl:if>
67               </xsl:for-each>
68             </p>
69           </xsl:if>
70
71           <xsl:if test="//dc:description" >
72             <p class="info"><xsl:value-of select="//dc:description" /></p>
73           </xsl:if>
74
75           <xsl:call-template name="editors" />
76
77           <xsl:call-template name="funders" />
78
79           <xsl:if test="@data-cover-by">
80             <p class="info">Okładka na podstawie: 
81             <xsl:choose>
82             <xsl:when test="@data-cover-source">
83                 <a>
84                 <xsl:attribute name="href">
85                   <xsl:value-of select="@data-cover-source" />
86                 </xsl:attribute>
87                 <xsl:value-of select="@data-cover-by" />
88                 </a>
89             </xsl:when>
90             <xsl:otherwise>
91                 <xsl:value-of select="@data-cover-by" />
92             </xsl:otherwise>
93             </xsl:choose>
94             </p>
95           </xsl:if>
96
97           <xsl:variable name="isbnId" select="concat($outputtype, '-id')"/>
98           <xsl:if test=".//meta[@id=$isbnId]">
99             <xsl:variable name="isbn" select=".//meta[@id=$isbnId]"/>
100             <p class="info">ISBN <xsl:value-of select="substring-after($isbn, 'ISBN-')"/></p>
101           </xsl:if>
102
103           <p class="info">&#160;</p>
104           <p class="minor-info">
105               Plik wygenerowany dnia <span id="file_date"><xsl:value-of select="substring(date:date(), 1, 10)" /></span>.
106           </p>
107
108         </div>
109       </body>
110     </html>
111   </xsl:template>
112
113   <xsl:template match="text()" >
114     <xsl:value-of select="." />
115   </xsl:template>
116
117   <xsl:template name="editors">
118     <xsl:if test="@editors">
119         <p class="info">
120             <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>
121             <xsl:value-of select="@editors" />.</p>
122     </xsl:if>
123   </xsl:template>
124
125   <xsl:template name="funders">
126     <xsl:if test="@funders">
127         <p class="minor-info">Publikację wsparli i wsparły:
128             <xsl:value-of select="@funders" />.</p>
129     </xsl:if>
130   </xsl:template>
131
132   <xsl:template match="text()" mode="person">
133     <xsl:value-of select="wl:person_name(.)" />
134   </xsl:template>
135 </xsl:stylesheet>