1 <?xml version="1.0" encoding="utf-8"?>
4 This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
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">
14 <!-- a nice epigraph section -->
15 <xsl:template match="nota_red" mode="sections">
17 <xsl:apply-templates mode="para"/>
21 <!-- main text is split by headings -->
22 <xsl:template match="naglowek_rozdzial" mode="sections">
25 This one's tricky - we need to sections text into sections.
26 In order to do that, all elements belonging to a single section
27 must have something in common. We assume that this common factor
28 is having the same number of following section headings.
33 <xsl:apply-templates mode="para"
34 select="../*[count(following-sibling::naglowek_rozdzial)
35 = count(current()/following-sibling::naglowek_rozdzial)]"/>
39 <!-- actual headings -->
40 <xsl:template match="naglowek_rozdzial" mode="para">
41 <title><p><xsl:apply-templates mode="inline"/></p></title>