FB2: add the 'created by wolnelektury.pl' note.
[librarian.git] / librarian / fb2 / poems.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         <!-- poems -->
15
16         <!-- match poem citations -->
17         <xsl:template mode="para" match="poezja_cyt">
18                 <cite>
19                         <poem>
20                                 <xsl:apply-templates mode="para"/>
21                         </poem>
22                 </cite>
23         </xsl:template>
24
25         <!-- regular poem elements -->
26         <xsl:template mode="para" match="strofa">
27                 <stanza>
28                         <xsl:call-template name="split-poem">
29                                 <xsl:with-param name="list" select="."/>
30                         </xsl:call-template>
31                 </stanza>
32         </xsl:template>
33
34         <!-- split into verses -->
35         <xsl:template name="split-poem">
36                 <xsl:param name="list"></xsl:param>
37
38                 <xsl:if test="$list != ''">
39                         <xsl:variable name="before"
40                                 select="substring-before(concat($list, '/'), '/')"/>
41                         <xsl:variable name="after"
42                                 select="substring-after($list, '/')"/>
43
44                         <v>
45                                 <xsl:value-of select="$before"/>
46                         </v>
47
48                         <xsl:call-template name="split-poem">
49                                 <xsl:with-param name="list" select="$after"/>
50                         </xsl:call-template>
51                 </xsl:if>
52         </xsl:template>
53 </xsl:stylesheet>