source: clfs-embedded/BOOK/stylesheets/lfs-xsl/chunkfast.xsl@ 3961d27

Last change on this file since 3961d27 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

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