]> git.stg.codes - stg.git/blob - doc/xslt/xhtml/chunkfast.xsl
Ticket 37. The changePolicy parameter added in the struct
[stg.git] / doc / xslt / xhtml / 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" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="cf exsl">
5
6 <!-- ********************************************************************
7      $Id: chunkfast.xsl 8345 2009-03-16 06:44:07Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <xsl:import href="chunk.xsl"/>
19 <xsl:param name="chunk.fast" select="1"/>
20
21 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
22
23 <!-- ==================================================================== -->
24
25 <xsl:template name="process-chunk-element">
26   <xsl:choose>
27     <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
28       <xsl:variable name="genid" select="generate-id()"/>
29
30       <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
31
32       <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
33       <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
34
35       <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
36       <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
37
38       <xsl:choose>
39         <xsl:when test="$onechunk != 0 and parent::*">
40           <xsl:apply-imports/>
41         </xsl:when>
42         <xsl:otherwise>
43           <xsl:call-template name="process-chunk">
44             <xsl:with-param name="prev" select="$prev"/>
45             <xsl:with-param name="next" select="$next"/>
46           </xsl:call-template>
47         </xsl:otherwise>
48       </xsl:choose>
49     </xsl:when>
50     <xsl:otherwise>
51       <xsl:choose>
52         <xsl:when test="$onechunk != 0 and not(parent::*)">
53           <xsl:call-template name="chunk-all-sections"/>
54         </xsl:when>
55         <xsl:when test="$onechunk != 0">
56           <xsl:apply-imports/>
57         </xsl:when>
58         <xsl:when test="$chunk.first.sections = 0">
59           <xsl:call-template name="chunk-first-section-with-parent"/>
60         </xsl:when>
61         <xsl:otherwise>
62           <xsl:call-template name="chunk-all-sections"/>
63         </xsl:otherwise>
64       </xsl:choose>
65     </xsl:otherwise>
66   </xsl:choose>
67 </xsl:template>
68
69 </xsl:stylesheet>