tests for handling "2 poł XIX w." dates + utf8 check
[librarian.git] / librarian / fb2 / sections.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:template name="section">
15         <!-- All the <_section> are in the end. -->
16         <xsl:if test="count(*) &gt; count(_section)">
17             <section>
18                 <xsl:choose>
19                     <xsl:when test="(local-name() = 'liryka_l' or local-name() = 'liryka_lp')
20                                      and count(_section) = 0">
21                         <poem>
22                             <xsl:apply-templates mode="para" />
23                         </poem>
24                     </xsl:when>
25                     <xsl:otherwise>
26                         <xsl:apply-templates mode="para" />
27                     </xsl:otherwise>
28                 </xsl:choose>
29             </section>
30         </xsl:if>
31
32         <!-- Now, recursively, all the _section tags. -->
33         <xsl:apply-templates mode="section" select="_section" />
34     </xsl:template>
35
36     <xsl:template match="_section" mode="para" />
37     <xsl:template match="_section" mode="section" >
38         <section>
39             <xsl:call-template name="section" />
40         </section>
41     </xsl:template>
42
43         <!-- actual headings -->
44         <xsl:template match="naglowek_czesc|naglowek_rozdzial|naglowek_podrozdzial|naglowek_akt|naglowek_scena" mode="para">
45                 <title><p><xsl:apply-templates mode="inline"/></p></title>
46         </xsl:template>
47 </xsl:stylesheet>