1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:exsl="http://exslt.org/common"
3 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
5 exclude-result-prefixes="cf exsl">
7 <!-- ********************************************************************
8 $Id: chunkfast.xsl 8345 2009-03-16 06:44:07Z bobstayton $
9 ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://docbook.sf.net/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
19 <xsl:import href="chunk.xsl"/>
20 <xsl:param name="chunk.fast" select="1"/>
22 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
24 <!-- ==================================================================== -->
26 <xsl:template name="process-chunk-element">
28 <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
29 <xsl:variable name="genid" select="generate-id()"/>
31 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
33 <xsl:variable name="prevdiv"
34 select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
35 <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
37 <xsl:variable name="nextdiv"
38 select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
39 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
42 <xsl:when test="$onechunk != 0 and parent::*">
46 <xsl:call-template name="process-chunk">
47 <xsl:with-param name="prev" select="$prev"/>
48 <xsl:with-param name="next" select="$next"/>
55 <xsl:when test="$onechunk != 0 and not(parent::*)">
56 <xsl:call-template name="chunk-all-sections"/>
58 <xsl:when test="$onechunk != 0">
61 <xsl:when test="$chunk.first.sections = 0">
62 <xsl:call-template name="chunk-first-section-with-parent"/>
65 <xsl:call-template name="chunk-all-sections"/>