source: stylesheets/lfs-xsl/chunkfast.xsl

trunk
Last change on this file was ab4fdfc, checked in by Pierre Labastie <pierre.labastie@…>, 3 months ago

Change all xml decl to encoding=utf-8

  • Property mode set to 100644
File size: 2.7 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns="http://www.w3.org/1999/xhtml"
5 xmlns:exsl="http://exslt.org/common"
6 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
7 version="1.0"
8 exclude-result-prefixes="cf exsl">
9
10 <!-- Top-level chunked code for fast processing.
11 Import standart customized chunk code.
12 Replaces {docbook-xsl}/xhtml/chunkfast.xsl
13
14 Note: Using this file as the top-level for chunked output implies that
15 profiling must be done on a previous step. -->
16
17 <!-- Our master chunking templates -->
18 <xsl:import href="chunk-master.xsl"/>
19
20 <!-- Use chunk.fast code? 1 = yes, 0 = no -->
21 <xsl:param name="chunk.fast" select="1"/>
22
23 <!-- The code below was copied as-is from {docbook-xsl}/xhtml/chunkfast.xsl -->
24
25 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
26
27 <xsl:template name="process-chunk-element">
28 <xsl:choose>
29 <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
30 <xsl:variable name="genid" select="generate-id()"/>
31
32 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
33
34 <xsl:variable name="prevdiv" 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])"/>
36
37 <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
38 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
39
40 <xsl:choose>
41 <xsl:when test="$onechunk != 0 and parent::*">
42 <xsl:apply-imports/>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:call-template name="process-chunk">
46 <xsl:with-param name="prev" select="$prev"/>
47 <xsl:with-param name="next" select="$next"/>
48 </xsl:call-template>
49 </xsl:otherwise>
50 </xsl:choose>
51 </xsl:when>
52 <xsl:otherwise>
53 <xsl:choose>
54 <xsl:when test="$onechunk != 0 and not(parent::*)">
55 <xsl:call-template name="chunk-all-sections"/>
56 </xsl:when>
57 <xsl:when test="$onechunk != 0">
58 <xsl:apply-imports/>
59 </xsl:when>
60 <xsl:when test="$chunk.first.sections = 0">
61 <xsl:call-template name="chunk-first-section-with-parent"/>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:call-template name="chunk-all-sections"/>
65 </xsl:otherwise>
66 </xsl:choose>
67 </xsl:otherwise>
68 </xsl:choose>
69 </xsl:template>
70
71</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.