]> git.lyx.org Git - lyx.git/blob - lib/docbook/epub3/chunkfast.xsl
Fix bug #11410.
[lyx.git] / lib / docbook / epub3 / chunkfast.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5                 xmlns:d="http://docbook.org/ns/docbook"
6                 xmlns:exsl="http://exslt.org/common"
7                 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
8                 xmlns="http://www.w3.org/1999/xhtml"
9                 version="1.0"
10                 exclude-result-prefixes="cf exsl d">
11
12 <!-- ********************************************************************
13
14      This file is part of the XSL DocBook Stylesheet distribution.
15      See ../README or http://cdn.docbook.org/release/xsl/current/ for
16      copyright and other information.
17
18      ******************************************************************** -->
19
20 <!-- ==================================================================== -->
21
22 <xsl:import href="chunk.xsl"/>
23 <xsl:param name="chunk.fast" select="1"/>
24
25 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
26
27 <!-- ==================================================================== -->
28
29 <xsl:template name="process-chunk-element">
30   <xsl:choose>
31     <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
32       <xsl:variable name="genid" select="generate-id()"/>
33
34       <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
35
36       <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
37       <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
38
39       <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
40       <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
41
42       <xsl:choose>
43         <xsl:when test="$onechunk != 0 and parent::*">
44           <xsl:apply-imports/>
45         </xsl:when>
46         <xsl:otherwise>
47           <xsl:call-template name="process-chunk">
48             <xsl:with-param name="prev" select="$prev"/>
49             <xsl:with-param name="next" select="$next"/>
50           </xsl:call-template>
51         </xsl:otherwise>
52       </xsl:choose>
53     </xsl:when>
54     <xsl:otherwise>
55       <xsl:choose>
56         <xsl:when test="$onechunk != 0 and not(parent::*)">
57           <xsl:call-template name="chunk-all-sections"/>
58         </xsl:when>
59         <xsl:when test="$onechunk != 0">
60           <xsl:apply-imports/>
61         </xsl:when>
62         <xsl:when test="$chunk.first.sections = 0">
63           <xsl:call-template name="chunk-first-section-with-parent"/>
64         </xsl:when>
65         <xsl:otherwise>
66           <xsl:call-template name="chunk-all-sections"/>
67         </xsl:otherwise>
68       </xsl:choose>
69     </xsl:otherwise>
70   </xsl:choose>
71 </xsl:template>
72
73 </xsl:stylesheet>