FB2: Create a <section/> over global scope text.
authorMichał Górny <mgorny@gentoo.org>
Wed, 25 Apr 2012 11:31:37 +0000 (13:31 +0200)
committerMichał Górny <mgorny@gentoo.org>
Sun, 6 May 2012 09:36:38 +0000 (11:36 +0200)
librarian/fb2/fb2.xslt
librarian/fb2/paragraphs.xslt

index e9ab6ce..47933c6 100644 (file)
                <body> <!-- main body for main book flow -->
                        <xsl:if test="autor_utworu or nazwa_utworu">
                                <title>
-                                       <xsl:apply-templates mode="para"
+                                       <xsl:apply-templates mode="title"
                                                select="autor_utworu|nazwa_utworu"/>
                                </title>
                        </xsl:if>
 
+                       <xsl:variable name="sections" select="count(naglowek_rozdzial)"/>
+                       <section>
+                               <xsl:apply-templates mode="para"
+                                       select="*[count(following-sibling::naglowek_rozdzial)
+                                               = $sections]"/>
+                       </section>
+
                        <xsl:apply-templates mode="sections"/>
                </body>
        </xsl:template>
+
+       <xsl:template mode="title" match="autor_utworu|nazwa_utworu">
+               <!-- title -->
+
+               <p><xsl:apply-templates mode="inline"/></p>
+       </xsl:template>
 </xsl:stylesheet>
index 9c7def8..01943a3 100644 (file)
 
        <!-- in paragraph mode -->
 
-       <xsl:template mode="para" match="autor_utworu|nazwa_utworu|akap|akap_dialog">
+       <xsl:template mode="para" match="akap|akap_dialog">
                <!-- paragraphs & similar -->
 
                <p><xsl:apply-templates mode="inline"/></p>
        </xsl:template>
 
-       <!-- in global scope -->
-
-       <xsl:template mode="sections" match="akap|akap_dialog">
-               <!-- paragraphs & similar -->
-
-               <p><xsl:apply-templates mode="inline"/></p>
-       </xsl:template>
-       <xsl:template mode="sections" match="autor_utworu|nazwa_utworu"/>
+       <xsl:template mode="para" match="*"/>
+       <xsl:template mode="sections" match="*"/>
 </xsl:stylesheet>