fix for empty dc tags
[librarian.git] / librarian / epub / xsltLast.xsl
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <xsl:stylesheet version="1.0"\r
3     xmlns="http://www.w3.org/1999/xhtml"\r
4     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
5     xmlns:dc="http://purl.org/dc/elements/1.1/"\r
6     xmlns:wl="http://wolnelektury.pl/functions"\r
7     xmlns:date="http://exslt.org/dates-and-times">\r
8   <xsl:output method="html" version="1.0" encoding="utf-8" />\r
9   <xsl:output doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />\r
10   <xsl:output doctype-public="-//W3C//DTD XHTML 1.1//EN" />\r
11 \r
12   <xsl:template match="/">\r
13     <html>\r
14       <head>\r
15         <link rel="stylesheet" href="style.css" type="text/css" />\r
16         <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\r
17         <title>\r
18           <xsl:text>Strona redakcyjna</xsl:text>\r
19         </title>\r
20       </head>\r
21       <body>\r
22         <div id="book-text" >\r
23           <p class="info">\r
24               <xsl:choose>\r
25                   <xsl:when test="//dc:rights.license">\r
26                       Ten utwór jest udostepniony na licencji\r
27                       <a>\r
28                           <xsl:attribute name="href">\r
29                               <xsl:value-of select="//dc:rights.license" />\r
30                           </xsl:attribute>\r
31                           <xsl:value-of select="//dc:rights" />\r
32                       </a>\r
33                   </xsl:when>\r
34                   <xsl:otherwise>\r
35                     Ten utwór nie jest chroniony prawem autorskim i znajduje się w domenie\r
36                     publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować\r
37                     i rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami\r
38                     (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to\r
39                     te dodatkowe materiały udostępnione są na licencji\r
40                     <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons\r
41                     Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL</a>.\r
42                   </xsl:otherwise>\r
43               </xsl:choose>\r
44           </p>\r
45 \r
46           <p class="info">Źródło: <a>\r
47               <xsl:attribute name="href">\r
48                   <xsl:value-of select="//dc:identifier.url" />\r
49               </xsl:attribute>\r
50               <xsl:attribute name="title">\r
51                   <xsl:value-of select="wl:person_name(//dc:creator/text())" />, <xsl:value-of select="//dc:title" />\r
52               </xsl:attribute>\r
53               <xsl:value-of select="//dc:identifier.url" />\r
54           </a></p>\r
55 \r
56           <xsl:if test="//dc:source" >\r
57             <p class="info">Tekst opracowany na podstawie: <xsl:value-of select="//dc:source" /></p>\r
58           </xsl:if>\r
59 \r
60           <xsl:if test="//dc:description" >\r
61             <p class="info"><xsl:value-of select="//dc:description" /></p>\r
62           </xsl:if>\r
63 \r
64           <xsl:call-template name="editors" />\r
65 \r
66           <p class="info">&#160;</p>\r
67           <p class="minor info">\r
68               Plik wygenerowany dnia <span id="file_date"><xsl:value-of select="substring(date:date(), 1, 10)" /></span>.\r
69           </p>\r
70 \r
71         </div>\r
72       </body>\r
73     </html>\r
74   </xsl:template>\r
75 \r
76   <xsl:template match="text()" >\r
77     <xsl:value-of select="." disable-output-escaping="yes" />\r
78   </xsl:template>\r
79 \r
80   <xsl:template name="editors">\r
81     <xsl:if test="//dc:contributor.editor[text()]|//dc:contributor.technical_editor[text()]">\r
82         <p class="info">\r
83             <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>\r
84             <xsl:for-each select="//dc:contributor.editor[text()]|//dc:contributor.technical_editor[text() and not(//dc:contributor.editor/text()=text())]">\r
85                 <xsl:sort />\r
86                 <xsl:if test="position() != 1">, </xsl:if>\r
87                 <xsl:apply-templates mode="person" />\r
88             </xsl:for-each>.\r
89         </p>\r
90     </xsl:if>\r
91   </xsl:template>\r
92 \r
93   <xsl:template match="dc:contributor.editor|dc:contributor.technical_editor">\r
94       <br /><xsl:apply-templates mode='person' />\r
95   </xsl:template>\r
96 \r
97   <xsl:template match="text()" mode="person">\r
98     <xsl:value-of select="wl:person_name(.)" />\r
99   </xsl:template>\r
100 </xsl:stylesheet>