source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml/chunk-common.xsl@ 58675ce

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 58675ce was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 82.8 KB
Line 
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:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl cf ng db">
5
6<!-- ********************************************************************
7 $Id: chunk-common.xsl 9717 2013-01-25 18:13:36Z 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:param name="onechunk" select="0"/>
19<xsl:param name="refentry.separator" select="0"/>
20<xsl:param name="chunk.fast" select="0"/>
21
22<xsl:key name="genid" match="*" use="generate-id()"/>
23
24<!-- ==================================================================== -->
25
26<xsl:variable name="chunk.hierarchy">
27 <xsl:if test="$chunk.fast != 0">
28 <xsl:choose>
29 <!-- Are we handling a docbook5 document? -->
30 <xsl:when test="$exsl.node.set.available != 0 and (*/self::ng:* or */self::db:*)">
31 <xsl:if test="$chunk.quietly = 0">
32 <xsl:message>Computing stripped namespace chunks...</xsl:message>
33 </xsl:if>
34 <xsl:apply-templates mode="find.chunks" select="exsl:node-set($no.namespace)"/>
35 </xsl:when>
36 <xsl:when test="$exsl.node.set.available != 0">
37 <xsl:if test="$chunk.quietly = 0">
38 <xsl:message>Computing chunks...</xsl:message>
39 </xsl:if>
40
41 <xsl:apply-templates select="/*" mode="find.chunks"/>
42 </xsl:when>
43 <xsl:otherwise>
44 <xsl:if test="$chunk.quietly = 0">
45 <xsl:message>
46 <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
47 <xsl:text>Using "slow" chunking.</xsl:text>
48 </xsl:message>
49 </xsl:if>
50 </xsl:otherwise>
51 </xsl:choose>
52 </xsl:if>
53</xsl:variable>
54
55<!-- ==================================================================== -->
56
57<xsl:template name="process-chunk-element">
58 <xsl:param name="content">
59 <xsl:apply-imports/>
60 </xsl:param>
61
62 <xsl:choose>
63 <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
64 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
65 <xsl:variable name="genid" select="generate-id()"/>
66
67 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
68
69 <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
70 <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
71
72 <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
73 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
74
75 <xsl:choose>
76 <xsl:when test="$onechunk != 0 and parent::*">
77 <xsl:copy-of select="$content"/>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:call-template name="process-chunk">
81 <xsl:with-param name="prev" select="$prev"/>
82 <xsl:with-param name="next" select="$next"/>
83 <xsl:with-param name="content" select="$content"/>
84 </xsl:call-template>
85 </xsl:otherwise>
86 </xsl:choose>
87 </xsl:when>
88 <xsl:otherwise>
89 <xsl:choose>
90 <xsl:when test="$onechunk != 0 and not(parent::*)">
91 <xsl:call-template name="chunk-all-sections">
92 <xsl:with-param name="content" select="$content"/>
93 </xsl:call-template>
94 </xsl:when>
95 <xsl:when test="$onechunk != 0">
96 <xsl:copy-of select="$content"/>
97 </xsl:when>
98 <xsl:when test="$chunk.first.sections = 0">
99 <xsl:call-template name="chunk-first-section-with-parent">
100 <xsl:with-param name="content" select="$content"/>
101 </xsl:call-template>
102 </xsl:when>
103 <xsl:otherwise>
104 <xsl:call-template name="chunk-all-sections">
105 <xsl:with-param name="content" select="$content"/>
106 </xsl:call-template>
107 </xsl:otherwise>
108 </xsl:choose>
109 </xsl:otherwise>
110 </xsl:choose>
111</xsl:template>
112
113<xsl:template name="process-chunk">
114 <xsl:param name="prev" select="."/>
115 <xsl:param name="next" select="."/>
116 <xsl:param name="content">
117 <xsl:apply-imports/>
118 </xsl:param>
119
120 <xsl:variable name="ischunk">
121 <xsl:call-template name="chunk"/>
122 </xsl:variable>
123
124 <xsl:variable name="chunkfn">
125 <xsl:if test="$ischunk='1'">
126 <xsl:apply-templates mode="chunk-filename" select="."/>
127 </xsl:if>
128 </xsl:variable>
129
130 <xsl:if test="$ischunk='0'">
131 <xsl:message>
132 <xsl:text>Error </xsl:text>
133 <xsl:value-of select="name(.)"/>
134 <xsl:text> is not a chunk!</xsl:text>
135 </xsl:message>
136 </xsl:if>
137
138 <xsl:variable name="filename">
139 <xsl:call-template name="make-relative-filename">
140 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
141 <xsl:with-param name="base.name" select="$chunkfn"/>
142 </xsl:call-template>
143 </xsl:variable>
144
145 <xsl:call-template name="write.chunk">
146 <xsl:with-param name="filename" select="$filename"/>
147 <xsl:with-param name="content">
148 <xsl:call-template name="chunk-element-content">
149 <xsl:with-param name="prev" select="$prev"/>
150 <xsl:with-param name="next" select="$next"/>
151 <xsl:with-param name="content" select="$content"/>
152 </xsl:call-template>
153 </xsl:with-param>
154 <xsl:with-param name="quiet" select="$chunk.quietly"/>
155 </xsl:call-template>
156</xsl:template>
157
158<xsl:template name="chunk-first-section-with-parent">
159 <xsl:param name="content">
160 <xsl:apply-imports/>
161 </xsl:param>
162
163 <!-- These xpath expressions are really hairy. The trick is to pick sections -->
164 <!-- that are not first children and are not the children of first children -->
165
166 <!-- Break these variables into pieces to work around
167 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
168
169 <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |ancestor::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |ancestor::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
170
171 <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |preceding::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |preceding::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
172
173 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::topic[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |ancestor::topic[1] |$prev-v1 |$prev-v2)[last()]"/>
174
175 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |following::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |following::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
176
177 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |descendant::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |descendant::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
178
179 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |following::article[1] |following::topic[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::topic[1] |descendant::bibliography[parent::article or parent::book or parent::part][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
180
181 <xsl:call-template name="process-chunk">
182 <xsl:with-param name="prev" select="$prev"/>
183 <xsl:with-param name="next" select="$next"/>
184 <xsl:with-param name="content" select="$content"/>
185 </xsl:call-template>
186</xsl:template>
187
188<xsl:template name="chunk-all-sections">
189 <xsl:param name="content">
190 <xsl:apply-imports/>
191 </xsl:param>
192
193 <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
194
195 <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
196
197 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::topic[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |ancestor::topic[1] |$prev-v1 |$prev-v2)[last()]"/>
198
199 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
200
201 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
202
203 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book][1] |following::article[1] |following::topic[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::topic[1] |descendant::bibliography[parent::article or parent::book][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
204
205 <xsl:call-template name="process-chunk">
206 <xsl:with-param name="prev" select="$prev"/>
207 <xsl:with-param name="next" select="$next"/>
208 <xsl:with-param name="content" select="$content"/>
209 </xsl:call-template>
210</xsl:template>
211
212<!-- ==================================================================== -->
213
214<!-- ==================================================================== -->
215
216<xsl:template name="make.lots">
217 <xsl:param name="toc.params" select="''"/>
218 <xsl:param name="toc"/>
219
220 <xsl:variable name="lots">
221 <xsl:if test="contains($toc.params, 'toc')">
222 <xsl:copy-of select="$toc"/>
223 </xsl:if>
224
225 <xsl:if test="contains($toc.params, 'figure')">
226 <xsl:choose>
227 <xsl:when test="$chunk.separate.lots != '0'">
228 <xsl:call-template name="make.lot.chunk">
229 <xsl:with-param name="type" select="'figure'"/>
230 <xsl:with-param name="lot">
231 <xsl:call-template name="list.of.titles">
232 <xsl:with-param name="titles" select="'figure'"/>
233 <xsl:with-param name="nodes" select=".//figure"/>
234 </xsl:call-template>
235 </xsl:with-param>
236 </xsl:call-template>
237 </xsl:when>
238 <xsl:otherwise>
239 <xsl:call-template name="list.of.titles">
240 <xsl:with-param name="titles" select="'figure'"/>
241 <xsl:with-param name="nodes" select=".//figure"/>
242 </xsl:call-template>
243 </xsl:otherwise>
244 </xsl:choose>
245 </xsl:if>
246
247 <xsl:if test="contains($toc.params, 'table')">
248 <xsl:choose>
249 <xsl:when test="$chunk.separate.lots != '0'">
250 <xsl:call-template name="make.lot.chunk">
251 <xsl:with-param name="type" select="'table'"/>
252 <xsl:with-param name="lot">
253 <xsl:call-template name="list.of.titles">
254 <xsl:with-param name="titles" select="'table'"/>
255 <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
256 </xsl:call-template>
257 </xsl:with-param>
258 </xsl:call-template>
259 </xsl:when>
260 <xsl:otherwise>
261 <xsl:call-template name="list.of.titles">
262 <xsl:with-param name="titles" select="'table'"/>
263 <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
264 </xsl:call-template>
265 </xsl:otherwise>
266 </xsl:choose>
267 </xsl:if>
268
269 <xsl:if test="contains($toc.params, 'example')">
270 <xsl:choose>
271 <xsl:when test="$chunk.separate.lots != '0'">
272 <xsl:call-template name="make.lot.chunk">
273 <xsl:with-param name="type" select="'example'"/>
274 <xsl:with-param name="lot">
275 <xsl:call-template name="list.of.titles">
276 <xsl:with-param name="titles" select="'example'"/>
277 <xsl:with-param name="nodes" select=".//example"/>
278 </xsl:call-template>
279 </xsl:with-param>
280 </xsl:call-template>
281 </xsl:when>
282 <xsl:otherwise>
283 <xsl:call-template name="list.of.titles">
284 <xsl:with-param name="titles" select="'example'"/>
285 <xsl:with-param name="nodes" select=".//example"/>
286 </xsl:call-template>
287 </xsl:otherwise>
288 </xsl:choose>
289 </xsl:if>
290
291 <xsl:if test="contains($toc.params, 'equation')">
292 <xsl:choose>
293 <xsl:when test="$chunk.separate.lots != '0'">
294 <xsl:call-template name="make.lot.chunk">
295 <xsl:with-param name="type" select="'equation'"/>
296 <xsl:with-param name="lot">
297 <xsl:call-template name="list.of.titles">
298 <xsl:with-param name="titles" select="'equation'"/>
299 <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
300 </xsl:call-template>
301 </xsl:with-param>
302 </xsl:call-template>
303 </xsl:when>
304 <xsl:otherwise>
305 <xsl:call-template name="list.of.titles">
306 <xsl:with-param name="titles" select="'equation'"/>
307 <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
308 </xsl:call-template>
309 </xsl:otherwise>
310 </xsl:choose>
311 </xsl:if>
312
313 <xsl:if test="contains($toc.params, 'procedure')">
314 <xsl:choose>
315 <xsl:when test="$chunk.separate.lots != '0'">
316 <xsl:call-template name="make.lot.chunk">
317 <xsl:with-param name="type" select="'procedure'"/>
318 <xsl:with-param name="lot">
319 <xsl:call-template name="list.of.titles">
320 <xsl:with-param name="titles" select="'procedure'"/>
321 <xsl:with-param name="nodes" select=".//procedure[title]"/>
322 </xsl:call-template>
323 </xsl:with-param>
324 </xsl:call-template>
325 </xsl:when>
326 <xsl:otherwise>
327 <xsl:call-template name="list.of.titles">
328 <xsl:with-param name="titles" select="'procedure'"/>
329 <xsl:with-param name="nodes" select=".//procedure[title]"/>
330 </xsl:call-template>
331 </xsl:otherwise>
332 </xsl:choose>
333 </xsl:if>
334 </xsl:variable>
335
336 <xsl:if test="string($lots) != ''">
337 <xsl:choose>
338 <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
339 <xsl:call-template name="write.chunk">
340 <xsl:with-param name="filename">
341 <xsl:call-template name="make-relative-filename">
342 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
343 <xsl:with-param name="base.name">
344 <xsl:call-template name="dbhtml-dir"/>
345 <xsl:value-of select="$chunked.filename.prefix"/>
346 <xsl:apply-templates select="." mode="recursive-chunk-filename">
347 <xsl:with-param name="recursive" select="true()"/>
348 </xsl:apply-templates>
349 <xsl:text>-toc</xsl:text>
350 <xsl:value-of select="$html.ext"/>
351 </xsl:with-param>
352 </xsl:call-template>
353 </xsl:with-param>
354 <xsl:with-param name="content">
355 <xsl:call-template name="chunk-element-content">
356 <xsl:with-param name="prev" select="/foo"/>
357 <xsl:with-param name="next" select="/foo"/>
358 <xsl:with-param name="nav.context" select="'toc'"/>
359 <xsl:with-param name="content">
360 <xsl:if test="$chunk.tocs.and.lots.has.title != 0">
361 <h1>
362 <xsl:apply-templates select="." mode="object.title.markup"/>
363 </h1>
364 </xsl:if>
365 <xsl:copy-of select="$lots"/>
366 </xsl:with-param>
367 </xsl:call-template>
368 </xsl:with-param>
369 <xsl:with-param name="quiet" select="$chunk.quietly"/>
370 </xsl:call-template>
371 </xsl:when>
372 <xsl:otherwise>
373 <xsl:copy-of select="$lots"/>
374 </xsl:otherwise>
375 </xsl:choose>
376 </xsl:if>
377</xsl:template>
378
379<xsl:template name="make.lot.chunk">
380 <xsl:param name="type" select="''"/>
381 <xsl:param name="lot"/>
382
383 <xsl:if test="string($lot) != ''">
384 <xsl:variable name="filename">
385 <xsl:call-template name="make-relative-filename">
386 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
387 <xsl:with-param name="base.name">
388 <xsl:call-template name="dbhtml-dir"/>
389 <xsl:value-of select="$type"/>
390 <xsl:text>-toc</xsl:text>
391 <xsl:value-of select="$html.ext"/>
392 </xsl:with-param>
393 </xsl:call-template>
394 </xsl:variable>
395
396 <xsl:variable name="href">
397 <xsl:call-template name="make-relative-filename">
398 <xsl:with-param name="base.dir" select="''"/>
399 <xsl:with-param name="base.name">
400 <xsl:call-template name="dbhtml-dir"/>
401 <xsl:value-of select="$type"/>
402 <xsl:text>-toc</xsl:text>
403 <xsl:value-of select="$html.ext"/>
404 </xsl:with-param>
405 </xsl:call-template>
406 </xsl:variable>
407
408 <xsl:call-template name="write.chunk">
409 <xsl:with-param name="filename" select="$filename"/>
410 <xsl:with-param name="content">
411 <xsl:call-template name="chunk-element-content">
412 <xsl:with-param name="prev" select="/foo"/>
413 <xsl:with-param name="next" select="/foo"/>
414 <xsl:with-param name="nav.context" select="'toc'"/>
415 <xsl:with-param name="content">
416 <xsl:copy-of select="$lot"/>
417 </xsl:with-param>
418 </xsl:call-template>
419 </xsl:with-param>
420 <xsl:with-param name="quiet" select="$chunk.quietly"/>
421 </xsl:call-template>
422 <!-- And output a link to this file -->
423 <div>
424 <xsl:attribute name="class">
425 <xsl:text>ListofTitles</xsl:text>
426 </xsl:attribute>
427 <a href="{$href}">
428 <xsl:call-template name="gentext">
429 <xsl:with-param name="key">
430 <xsl:choose>
431 <xsl:when test="$type='table'">ListofTables</xsl:when>
432 <xsl:when test="$type='figure'">ListofFigures</xsl:when>
433 <xsl:when test="$type='equation'">ListofEquations</xsl:when>
434 <xsl:when test="$type='example'">ListofExamples</xsl:when>
435 <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
436 <xsl:otherwise>ListofUnknown</xsl:otherwise>
437 </xsl:choose>
438 </xsl:with-param>
439 </xsl:call-template>
440 </a>
441 </div>
442 </xsl:if>
443</xsl:template>
444
445<!-- ==================================================================== -->
446
447<xsl:template name="in.other.chunk">
448 <xsl:param name="chunk" select="."/>
449 <xsl:param name="node" select="."/>
450
451 <xsl:variable name="is.chunk">
452 <xsl:call-template name="chunk">
453 <xsl:with-param name="node" select="$node"/>
454 </xsl:call-template>
455 </xsl:variable>
456
457<!--
458 <xsl:message>
459 <xsl:text>in.other.chunk: </xsl:text>
460 <xsl:value-of select="name($chunk)"/>
461 <xsl:text> </xsl:text>
462 <xsl:value-of select="name($node)"/>
463 <xsl:text> </xsl:text>
464 <xsl:value-of select="$chunk = $node"/>
465 <xsl:text> </xsl:text>
466 <xsl:value-of select="$is.chunk"/>
467 </xsl:message>
468-->
469
470 <xsl:choose>
471 <xsl:when test="$chunk = $node">0</xsl:when>
472 <xsl:when test="$is.chunk = 1">1</xsl:when>
473 <xsl:when test="count($node) = 0">0</xsl:when>
474 <xsl:otherwise>
475 <xsl:call-template name="in.other.chunk">
476 <xsl:with-param name="chunk" select="$chunk"/>
477 <xsl:with-param name="node" select="$node/parent::*"/>
478 </xsl:call-template>
479 </xsl:otherwise>
480 </xsl:choose>
481</xsl:template>
482
483<xsl:template name="count.footnotes.in.this.chunk">
484 <xsl:param name="node" select="."/>
485 <xsl:param name="footnotes" select="$node//footnote"/>
486 <xsl:param name="count" select="0"/>
487
488<!--
489 <xsl:message>
490 <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
491 <xsl:value-of select="name($node)"/>
492 </xsl:message>
493-->
494
495 <xsl:variable name="in.other.chunk">
496 <xsl:call-template name="in.other.chunk">
497 <xsl:with-param name="chunk" select="$node"/>
498 <xsl:with-param name="node" select="$footnotes[1]"/>
499 </xsl:call-template>
500 </xsl:variable>
501
502 <xsl:choose>
503 <xsl:when test="count($footnotes) = 0">
504 <xsl:value-of select="$count"/>
505 </xsl:when>
506 <xsl:otherwise>
507 <xsl:choose>
508 <xsl:when test="$in.other.chunk != 0">
509 <xsl:call-template name="count.footnotes.in.this.chunk">
510 <xsl:with-param name="node" select="$node"/>
511 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
512 <xsl:with-param name="count" select="$count"/>
513 </xsl:call-template>
514 </xsl:when>
515 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
516 <xsl:call-template name="count.footnotes.in.this.chunk">
517 <xsl:with-param name="node" select="$node"/>
518 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
519 <xsl:with-param name="count" select="$count"/>
520 </xsl:call-template>
521 </xsl:when>
522 <xsl:otherwise>
523 <xsl:call-template name="count.footnotes.in.this.chunk">
524 <xsl:with-param name="node" select="$node"/>
525 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
526 <xsl:with-param name="count" select="$count + 1"/>
527 </xsl:call-template>
528 </xsl:otherwise>
529 </xsl:choose>
530 </xsl:otherwise>
531 </xsl:choose>
532</xsl:template>
533
534<xsl:template name="process.footnotes.in.this.chunk">
535 <xsl:param name="node" select="."/>
536 <xsl:param name="footnotes" select="$node//footnote"/>
537
538<!--
539 <xsl:message>process.footnotes.in.this.chunk</xsl:message>
540-->
541
542 <xsl:variable name="in.other.chunk">
543 <xsl:call-template name="in.other.chunk">
544 <xsl:with-param name="chunk" select="$node"/>
545 <xsl:with-param name="node" select="$footnotes[1]"/>
546 </xsl:call-template>
547 </xsl:variable>
548
549 <xsl:choose>
550 <xsl:when test="count($footnotes) = 0">
551 <!-- nop -->
552 </xsl:when>
553 <xsl:otherwise>
554 <xsl:choose>
555 <xsl:when test="$in.other.chunk != 0">
556 <xsl:call-template name="process.footnotes.in.this.chunk">
557 <xsl:with-param name="node" select="$node"/>
558 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
559 </xsl:call-template>
560 </xsl:when>
561 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
562 <xsl:call-template name="process.footnotes.in.this.chunk">
563 <xsl:with-param name="node" select="$node"/>
564 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
565 </xsl:call-template>
566 </xsl:when>
567 <xsl:otherwise>
568 <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
569 <xsl:call-template name="process.footnotes.in.this.chunk">
570 <xsl:with-param name="node" select="$node"/>
571 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
572 </xsl:call-template>
573 </xsl:otherwise>
574 </xsl:choose>
575 </xsl:otherwise>
576 </xsl:choose>
577</xsl:template>
578
579<xsl:template name="process.footnotes">
580 <xsl:variable name="footnotes" select=".//footnote"/>
581 <xsl:variable name="fcount">
582 <xsl:call-template name="count.footnotes.in.this.chunk">
583 <xsl:with-param name="node" select="."/>
584 <xsl:with-param name="footnotes" select="$footnotes"/>
585 </xsl:call-template>
586 </xsl:variable>
587
588<!--
589 <xsl:message>
590 <xsl:value-of select="name(.)"/>
591 <xsl:text> fcount: </xsl:text>
592 <xsl:value-of select="$fcount"/>
593 </xsl:message>
594-->
595
596 <!-- Only bother to do this if there's at least one non-table footnote -->
597 <xsl:if test="$fcount &gt; 0">
598 <div class="footnotes">
599 <xsl:call-template name="footnotes.attributes"/>
600 <br/>
601 <hr>
602 <xsl:choose>
603 <xsl:when test="$make.clean.html != 0">
604 <xsl:attribute name="class">footnote-hr</xsl:attribute>
605 </xsl:when>
606 <xsl:when test="$css.decoration != 0">
607 <xsl:attribute name="style">
608 <xsl:value-of select="concat('width:100; text-align:', $direction.align.start, ';', 'margin-', $direction.align.start, ': 0')"/>
609 </xsl:attribute>
610 </xsl:when>
611 <xsl:otherwise>
612 <xsl:attribute name="width">100</xsl:attribute>
613 <xsl:attribute name="align"><xsl:value-of select="$direction.align.start"/></xsl:attribute>
614 </xsl:otherwise>
615 </xsl:choose>
616 </hr>
617 <xsl:call-template name="process.footnotes.in.this.chunk">
618 <xsl:with-param name="node" select="."/>
619 <xsl:with-param name="footnotes" select="$footnotes"/>
620 </xsl:call-template>
621 </div>
622 </xsl:if>
623
624 <!-- FIXME: When chunking, only the annotations actually used
625 in this chunk should be referenced. I don't think it
626 does any harm to reference them all, but it adds
627 unnecessary bloat to each chunk. -->
628 <xsl:if test="$annotation.support != 0 and //annotation">
629 <div class="annotation-list">
630 <div class="annotation-nocss">
631 <p>The following annotations are from this essay. You are seeing
632 them here because your browser doesn&#8217;t support the user-interface
633 techniques used to make them appear as &#8216;popups&#8217; on modern browsers.</p>
634 </div>
635
636 <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
637 </div>
638 </xsl:if>
639</xsl:template>
640
641<xsl:template name="process.chunk.footnotes">
642 <xsl:variable name="is.chunk">
643 <xsl:call-template name="chunk"/>
644 </xsl:variable>
645 <xsl:if test="$is.chunk = 1">
646 <xsl:call-template name="process.footnotes"/>
647 </xsl:if>
648</xsl:template>
649
650<!-- ====================================================================== -->
651
652<xsl:template name="chunk">
653 <xsl:param name="node" select="."/>
654 <!-- returns 1 if $node is a chunk -->
655
656 <!-- ==================================================================== -->
657 <!-- What's a chunk?
658
659 The root element
660 appendix
661 article
662 bibliography in article or part or book
663 book
664 chapter
665 colophon
666 glossary in article or part or book
667 index in article or part or book
668 part
669 preface
670 refentry
671 reference
672 sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
673 section if position()>1 && depth < chunk.section.depth
674 set
675 setindex
676 topic
677 -->
678 <!-- ==================================================================== -->
679
680<!--
681 <xsl:message>
682 <xsl:text>chunk: </xsl:text>
683 <xsl:value-of select="name($node)"/>
684 <xsl:text>(</xsl:text>
685 <xsl:value-of select="$node/@id"/>
686 <xsl:text>)</xsl:text>
687 <xsl:text> csd: </xsl:text>
688 <xsl:value-of select="$chunk.section.depth"/>
689 <xsl:text> cfs: </xsl:text>
690 <xsl:value-of select="$chunk.first.sections"/>
691 <xsl:text> ps: </xsl:text>
692 <xsl:value-of select="count($node/parent::section)"/>
693 <xsl:text> prs: </xsl:text>
694 <xsl:value-of select="count($node/preceding-sibling::section)"/>
695 </xsl:message>
696-->
697
698 <xsl:choose>
699 <xsl:when test="$node/parent::*/processing-instruction('dbhtml')[normalize-space(.) = 'stop-chunking']">0</xsl:when>
700 <xsl:when test="not($node/parent::*)">1</xsl:when>
701
702 <xsl:when test="local-name($node) = 'sect1' and $chunk.section.depth &gt;= 1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect1) &gt; 0)">
703 <xsl:text>1</xsl:text>
704 </xsl:when>
705 <xsl:when test="local-name($node) = 'sect2' and $chunk.section.depth &gt;= 2 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect2) &gt; 0)">
706 <xsl:call-template name="chunk">
707 <xsl:with-param name="node" select="$node/parent::*"/>
708 </xsl:call-template>
709 </xsl:when>
710 <xsl:when test="local-name($node) = 'sect3' and $chunk.section.depth &gt;= 3 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect3) &gt; 0)">
711 <xsl:call-template name="chunk">
712 <xsl:with-param name="node" select="$node/parent::*"/>
713 </xsl:call-template>
714 </xsl:when>
715 <xsl:when test="local-name($node) = 'sect4' and $chunk.section.depth &gt;= 4 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect4) &gt; 0)">
716 <xsl:call-template name="chunk">
717 <xsl:with-param name="node" select="$node/parent::*"/>
718 </xsl:call-template>
719 </xsl:when>
720 <xsl:when test="local-name($node) = 'sect5' and $chunk.section.depth &gt;= 5 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect5) &gt; 0)">
721 <xsl:call-template name="chunk">
722 <xsl:with-param name="node" select="$node/parent::*"/>
723 </xsl:call-template>
724 </xsl:when>
725 <xsl:when test="local-name($node) = 'section' and $chunk.section.depth &gt;= count($node/ancestor::section)+1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::section) &gt; 0)">
726 <xsl:call-template name="chunk">
727 <xsl:with-param name="node" select="$node/parent::*"/>
728 </xsl:call-template>
729 </xsl:when>
730
731 <xsl:when test="local-name($node)='preface'">1</xsl:when>
732 <xsl:when test="local-name($node)='chapter'">1</xsl:when>
733 <xsl:when test="local-name($node)='appendix'">1</xsl:when>
734 <xsl:when test="local-name($node)='article'">1</xsl:when>
735 <xsl:when test="local-name($node)='topic'">1</xsl:when>
736 <xsl:when test="local-name($node)='part'">1</xsl:when>
737 <xsl:when test="local-name($node)='reference'">1</xsl:when>
738 <xsl:when test="local-name($node)='refentry'">1</xsl:when>
739 <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count($node/*) &gt; 0) and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
740 <xsl:when test="local-name($node)='bibliography' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
741 <xsl:when test="local-name($node)='glossary' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
742 <xsl:when test="local-name($node)='colophon'">1</xsl:when>
743 <xsl:when test="local-name($node)='book'">1</xsl:when>
744 <xsl:when test="local-name($node)='set'">1</xsl:when>
745 <xsl:when test="local-name($node)='setindex'">1</xsl:when>
746 <xsl:when test="local-name($node)='legalnotice' and $generate.legalnotice.link != 0">1</xsl:when>
747 <xsl:otherwise>0</xsl:otherwise>
748 </xsl:choose>
749</xsl:template>
750
751<!-- ==================================================================== -->
752<xsl:template name="href.target.uri">
753 <xsl:param name="object" select="."/>
754 <xsl:variable name="ischunk">
755 <xsl:call-template name="chunk">
756 <xsl:with-param name="node" select="$object"/>
757 </xsl:call-template>
758 </xsl:variable>
759
760 <xsl:apply-templates mode="chunk-filename" select="$object"/>
761
762 <xsl:if test="$ischunk='0'">
763 <xsl:text>#</xsl:text>
764 <xsl:call-template name="object.id">
765 <xsl:with-param name="object" select="$object"/>
766 </xsl:call-template>
767 </xsl:if>
768</xsl:template>
769
770<xsl:template name="href.target">
771 <xsl:param name="context" select="."/>
772 <xsl:param name="object" select="."/>
773 <xsl:param name="toc-context" select="."/>
774 <!-- * If $toc-context contains some node other than the current node, -->
775 <!-- * it means we're processing a link in a TOC. In that case, to -->
776 <!-- * ensure the link will work correctly, we need to take a look at -->
777 <!-- * where the file containing the TOC will get written, and where -->
778 <!-- * the file that's being linked to will get written. -->
779 <xsl:variable name="toc-output-dir">
780 <xsl:if test="not($toc-context = .)">
781 <!-- * Get the $toc-context node and all its ancestors, look down -->
782 <!-- * through them to find the last/closest node to the -->
783 <!-- * toc-context node that has a "dbhtml dir" PI, and get the -->
784 <!-- * directory name from that. That's the name of the directory -->
785 <!-- * to which the current toc output file will get written. -->
786 <xsl:call-template name="dbhtml-dir">
787 <xsl:with-param name="context" select="$toc-context/ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
788 </xsl:call-template>
789 </xsl:if>
790 </xsl:variable>
791 <xsl:variable name="linked-file-output-dir">
792 <xsl:if test="not($toc-context = .)">
793 <!-- * Get the current node and all its ancestors, look down -->
794 <!-- * through them to find the last/closest node to the current -->
795 <!-- * node that has a "dbhtml dir" PI, and get the directory name -->
796 <!-- * from that. That's the name of the directory to which the -->
797 <!-- * file that's being linked to will get written. -->
798 <xsl:call-template name="dbhtml-dir">
799 <xsl:with-param name="context" select="ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
800 </xsl:call-template>
801 </xsl:if>
802 </xsl:variable>
803 <xsl:variable name="href.to.uri">
804 <xsl:call-template name="href.target.uri">
805 <xsl:with-param name="object" select="$object"/>
806 </xsl:call-template>
807 </xsl:variable>
808 <xsl:variable name="href.from.uri">
809 <xsl:choose>
810 <xsl:when test="not($toc-context = .)">
811 <xsl:call-template name="href.target.uri">
812 <xsl:with-param name="object" select="$toc-context"/>
813 </xsl:call-template>
814 </xsl:when>
815 <xsl:otherwise>
816 <xsl:call-template name="href.target.uri">
817 <xsl:with-param name="object" select="$context"/>
818 </xsl:call-template>
819 </xsl:otherwise>
820 </xsl:choose>
821 </xsl:variable>
822 <!-- * <xsl:message>toc-context: <xsl:value-of select="local-name($toc-context)"/></xsl:message> -->
823 <!-- * <xsl:message>node: <xsl:value-of select="local-name(.)"/></xsl:message> -->
824 <!-- * <xsl:message>context: <xsl:value-of select="local-name($context)"/></xsl:message> -->
825 <!-- * <xsl:message>object: <xsl:value-of select="local-name($object)"/></xsl:message> -->
826 <!-- * <xsl:message>toc-output-dir: <xsl:value-of select="$toc-output-dir"/></xsl:message> -->
827 <!-- * <xsl:message>linked-file-output-dir: <xsl:value-of select="$linked-file-output-dir"/></xsl:message> -->
828 <!-- * <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message> -->
829 <!-- * <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message> -->
830 <xsl:variable name="href.to">
831 <xsl:choose>
832 <!-- * 2007-07-19, MikeSmith: Added the following conditional to -->
833 <!-- * deal with a problem case for links in TOCs. It checks to see -->
834 <!-- * if the output dir that a TOC will get written to is -->
835 <!-- * different from the output dir of the file being linked to. -->
836 <!-- * If it is different, we do not call trim.common.uri.paths. -->
837 <!-- * -->
838 <!-- * Reason why I added that conditional is: I ran into a bug for -->
839 <!-- * this case: -->
840 <!-- * -->
841 <!-- * 1. we are chunking into separate dirs -->
842 <!-- * -->
843 <!-- * 2. output for the TOC is written to current dir, but the file -->
844 <!-- * being linked to is written to some subdir "foo". -->
845 <!-- * -->
846 <!-- * For that case, links to that file in that TOC did not show -->
847 <!-- * the correct path - they omitted the "foo". -->
848 <!-- * -->
849 <!-- * The cause of that problem was that the trim.common.uri.paths -->
850 <!-- * template[1] was being called under all conditions. But it's -->
851 <!-- * apparent that we don't want to call trim.common.uri.paths in -->
852 <!-- * the case where a linked file is being written to a different -->
853 <!-- * directory than the TOC that contains the link, because doing -->
854 <!-- * so will cause a necessary (not redundant) directory-name -->
855 <!-- * part of the link to get inadvertently trimmed, resulting in -->
856 <!-- * a broken link to that file. Thus, added the conditional. -->
857 <!-- * -->
858 <!-- * [1] The purpose of the trim.common.uri.paths template is to -->
859 <!-- * prevent cases where, if we didn't call it, we end up with -->
860 <!-- * unnecessary, redundant directory names getting output; for -->
861 <!-- * example, "foo/foo/refname.html". -->
862 <xsl:when test="not($toc-output-dir = $linked-file-output-dir)">
863 <xsl:value-of select="$href.to.uri"/>
864 </xsl:when>
865 <xsl:otherwise>
866 <xsl:call-template name="trim.common.uri.paths">
867 <xsl:with-param name="uriA" select="$href.to.uri"/>
868 <xsl:with-param name="uriB" select="$href.from.uri"/>
869 <xsl:with-param name="return" select="'A'"/>
870 </xsl:call-template>
871 </xsl:otherwise>
872 </xsl:choose>
873 </xsl:variable>
874 <xsl:variable name="href.from">
875 <xsl:call-template name="trim.common.uri.paths">
876 <xsl:with-param name="uriA" select="$href.to.uri"/>
877 <xsl:with-param name="uriB" select="$href.from.uri"/>
878 <xsl:with-param name="return" select="'B'"/>
879 </xsl:call-template>
880 </xsl:variable>
881 <xsl:variable name="depth">
882 <xsl:call-template name="count.uri.path.depth">
883 <xsl:with-param name="filename" select="$href.from"/>
884 </xsl:call-template>
885 </xsl:variable>
886 <xsl:variable name="href">
887 <xsl:call-template name="copy-string">
888 <xsl:with-param name="string" select="'../'"/>
889 <xsl:with-param name="count" select="$depth"/>
890 </xsl:call-template>
891 <xsl:value-of select="$href.to"/>
892 </xsl:variable>
893 <!--
894 <xsl:message>
895 <xsl:text>In </xsl:text>
896 <xsl:value-of select="name(.)"/>
897 <xsl:text> (</xsl:text>
898 <xsl:value-of select="$href.from"/>
899 <xsl:text>,</xsl:text>
900 <xsl:value-of select="$depth"/>
901 <xsl:text>) </xsl:text>
902 <xsl:value-of select="name($object)"/>
903 <xsl:text> href=</xsl:text>
904 <xsl:value-of select="$href"/>
905 </xsl:message>
906 -->
907 <xsl:value-of select="$href"/>
908</xsl:template>
909
910<!-- Returns the complete olink href value if found -->
911<!-- Must take into account any dbhtml dir of the chunk containing the olink -->
912<xsl:template name="make.olink.href">
913 <xsl:param name="olink.key" select="''"/>
914 <xsl:param name="target.database"/>
915
916 <xsl:if test="$olink.key != ''">
917 <xsl:variable name="target.href">
918 <xsl:for-each select="$target.database">
919 <xsl:value-of select="key('targetptr-key', $olink.key)[1]/@href"/>
920 </xsl:for-each>
921 </xsl:variable>
922
923 <!-- an olink starting point may be in a subdirectory, so need
924 the "from" reference point to compute a relative path -->
925
926 <xsl:variable name="from.href">
927 <xsl:call-template name="olink.from.uri">
928 <xsl:with-param name="target.database" select="$target.database"/>
929 <xsl:with-param name="object" select="."/>
930 <xsl:with-param name="object.targetdoc" select="$current.docid"/>
931 </xsl:call-template>
932 </xsl:variable>
933
934 <!-- If the from.href has directory path, then must "../" upward
935 to document level -->
936 <xsl:variable name="upward.from.path">
937 <xsl:call-template name="upward.path">
938 <xsl:with-param name="path" select="$from.href"/>
939 </xsl:call-template>
940 </xsl:variable>
941
942 <xsl:variable name="targetdoc">
943 <xsl:value-of select="substring-before($olink.key, '/')"/>
944 </xsl:variable>
945
946 <!-- Does the target database use a sitemap? -->
947 <xsl:variable name="use.sitemap">
948 <xsl:choose>
949 <xsl:when test="$target.database//sitemap">1</xsl:when>
950 <xsl:otherwise>0</xsl:otherwise>
951 </xsl:choose>
952 </xsl:variable>
953
954
955 <!-- Get the baseuri for this targetptr -->
956 <xsl:variable name="baseuri">
957 <xsl:choose>
958 <!-- Does the database use a sitemap? -->
959 <xsl:when test="$use.sitemap != 0">
960 <xsl:choose>
961 <!-- Was current.docid parameter set? -->
962 <xsl:when test="$current.docid != ''">
963 <!-- Was it found in the database? -->
964 <xsl:variable name="currentdoc.key">
965 <xsl:for-each select="$target.database">
966 <xsl:value-of select="key('targetdoc-key', $current.docid)[1]/@targetdoc"/>
967 </xsl:for-each>
968 </xsl:variable>
969 <xsl:choose>
970 <xsl:when test="$currentdoc.key != ''">
971 <xsl:for-each select="$target.database">
972 <xsl:call-template name="targetpath">
973 <xsl:with-param name="dirnode" select="key('targetdoc-key', $current.docid)[1]/parent::dir"/>
974 <xsl:with-param name="targetdoc" select="$targetdoc"/>
975 </xsl:call-template>
976 </xsl:for-each>
977 </xsl:when>
978 <xsl:otherwise>
979 <xsl:message>
980 <xsl:text>Olink error: cannot compute relative </xsl:text>
981 <xsl:text>sitemap path because $current.docid '</xsl:text>
982 <xsl:value-of select="$current.docid"/>
983 <xsl:text>' not found in target database.</xsl:text>
984 </xsl:message>
985 </xsl:otherwise>
986 </xsl:choose>
987 </xsl:when>
988 <xsl:otherwise>
989 <xsl:message>
990 <xsl:text>Olink warning: cannot compute relative </xsl:text>
991 <xsl:text>sitemap path without $current.docid parameter</xsl:text>
992 </xsl:message>
993 </xsl:otherwise>
994 </xsl:choose>
995 <!-- In either case, add baseuri from its document entry-->
996 <xsl:variable name="docbaseuri">
997 <xsl:for-each select="$target.database">
998 <xsl:value-of select="key('targetdoc-key', $targetdoc)[1]/@baseuri"/>
999 </xsl:for-each>
1000 </xsl:variable>
1001 <xsl:if test="$docbaseuri != ''">
1002 <xsl:value-of select="$docbaseuri"/>
1003 </xsl:if>
1004 </xsl:when>
1005 <!-- No database sitemap in use -->
1006 <xsl:otherwise>
1007 <!-- Just use any baseuri from its document entry -->
1008 <xsl:variable name="docbaseuri">
1009 <xsl:for-each select="$target.database">
1010 <xsl:value-of select="key('targetdoc-key', $targetdoc)[1]/@baseuri"/>
1011 </xsl:for-each>
1012 </xsl:variable>
1013 <xsl:if test="$docbaseuri != ''">
1014 <xsl:value-of select="$docbaseuri"/>
1015 </xsl:if>
1016 </xsl:otherwise>
1017 </xsl:choose>
1018 </xsl:variable>
1019
1020 <!-- Is this olink to be active? -->
1021 <xsl:variable name="active.olink">
1022 <xsl:choose>
1023 <xsl:when test="$activate.external.olinks = 0">
1024 <xsl:choose>
1025 <xsl:when test="$current.docid = ''">1</xsl:when>
1026 <xsl:when test="$targetdoc = ''">1</xsl:when>
1027 <xsl:when test="$targetdoc = $current.docid">1</xsl:when>
1028 <xsl:otherwise>0</xsl:otherwise>
1029 </xsl:choose>
1030 </xsl:when>
1031 <xsl:otherwise>1</xsl:otherwise>
1032 </xsl:choose>
1033 </xsl:variable>
1034
1035 <xsl:if test="$active.olink != 0">
1036 <!-- Form the href information -->
1037 <xsl:if test="not(contains($baseuri, ':'))">
1038 <!-- if not an absolute uri, add upward path from olink chunk -->
1039 <xsl:value-of select="$upward.from.path"/>
1040 </xsl:if>
1041
1042 <xsl:if test="$baseuri != ''">
1043 <xsl:value-of select="$baseuri"/>
1044 <xsl:if test="substring($target.href,1,1) != '#'">
1045 <!--xsl:text>/</xsl:text-->
1046 </xsl:if>
1047 </xsl:if>
1048 <!-- optionally turn off frag for PDF references -->
1049 <xsl:if test="not($insert.olink.pdf.frag = 0 and translate(substring($baseuri, string-length($baseuri) - 3), 'PDF', 'pdf') = '.pdf' and starts-with($target.href, '#') )">
1050 <xsl:value-of select="$target.href"/>
1051 </xsl:if>
1052 </xsl:if>
1053 </xsl:if>
1054</xsl:template>
1055
1056<!-- Computes "../" to reach top -->
1057<xsl:template name="upward.path">
1058 <xsl:param name="path" select="''"/>
1059 <xsl:choose>
1060 <!-- Don't bother with absolute uris -->
1061 <xsl:when test="contains($path, ':')"/>
1062 <xsl:when test="starts-with($path, '/')"/>
1063 <xsl:when test="contains($path, '/')">
1064 <xsl:text>../</xsl:text>
1065 <xsl:call-template name="upward.path">
1066 <xsl:with-param name="path" select="substring-after($path, '/')"/>
1067 </xsl:call-template>
1068 </xsl:when>
1069 </xsl:choose>
1070
1071</xsl:template>
1072
1073<!-- ==================================================================== -->
1074
1075<xsl:template name="html.head">
1076 <xsl:param name="prev" select="/foo"/>
1077 <xsl:param name="next" select="/foo"/>
1078 <xsl:variable name="this" select="."/>
1079 <xsl:variable name="home" select="/*[1]"/>
1080 <xsl:variable name="up" select="parent::*"/>
1081
1082 <head>
1083 <xsl:call-template name="system.head.content"/>
1084 <xsl:call-template name="head.content"/>
1085
1086 <!-- home link not valid in HTML5 -->
1087 <xsl:if test="$home and $div.element != 'section'">
1088 <link rel="home">
1089 <xsl:attribute name="href">
1090 <xsl:call-template name="href.target">
1091 <xsl:with-param name="object" select="$home"/>
1092 </xsl:call-template>
1093 </xsl:attribute>
1094 <xsl:attribute name="title">
1095 <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
1096 </xsl:attribute>
1097 </link>
1098 </xsl:if>
1099
1100 <!-- up link not valid in HTML5 -->
1101 <xsl:if test="$up and $div.element != 'section'">
1102 <link rel="up">
1103 <xsl:attribute name="href">
1104 <xsl:call-template name="href.target">
1105 <xsl:with-param name="object" select="$up"/>
1106 </xsl:call-template>
1107 </xsl:attribute>
1108 <xsl:attribute name="title">
1109 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
1110 </xsl:attribute>
1111 </link>
1112 </xsl:if>
1113
1114 <xsl:if test="$prev">
1115 <link rel="prev">
1116 <xsl:attribute name="href">
1117 <xsl:call-template name="href.target">
1118 <xsl:with-param name="object" select="$prev"/>
1119 </xsl:call-template>
1120 </xsl:attribute>
1121 <xsl:attribute name="title">
1122 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
1123 </xsl:attribute>
1124 </link>
1125 </xsl:if>
1126
1127 <xsl:if test="$next">
1128 <link rel="next">
1129 <xsl:attribute name="href">
1130 <xsl:call-template name="href.target">
1131 <xsl:with-param name="object" select="$next"/>
1132 </xsl:call-template>
1133 </xsl:attribute>
1134 <xsl:attribute name="title">
1135 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
1136 </xsl:attribute>
1137 </link>
1138 </xsl:if>
1139
1140 <xsl:if test="$html.extra.head.links != 0">
1141 <xsl:for-each select="//part |//reference |//preface |//chapter |//article |//refentry |//appendix[not(parent::article)]|appendix |//glossary[not(parent::article)]|glossary |//index[not(parent::article)]|index">
1142 <link rel="{local-name(.)}">
1143 <xsl:attribute name="href">
1144 <xsl:call-template name="href.target">
1145 <xsl:with-param name="context" select="$this"/>
1146 <xsl:with-param name="object" select="."/>
1147 </xsl:call-template>
1148 </xsl:attribute>
1149 <xsl:attribute name="title">
1150 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1151 </xsl:attribute>
1152 </link>
1153 </xsl:for-each>
1154
1155 <xsl:for-each select="section|sect1|refsection|refsect1">
1156 <link>
1157 <xsl:attribute name="rel">
1158 <xsl:choose>
1159 <xsl:when test="local-name($this) = 'section' or local-name($this) = 'refsection'">
1160 <xsl:value-of select="'subsection'"/>
1161 </xsl:when>
1162 <xsl:otherwise>
1163 <xsl:value-of select="'section'"/>
1164 </xsl:otherwise>
1165 </xsl:choose>
1166 </xsl:attribute>
1167 <xsl:attribute name="href">
1168 <xsl:call-template name="href.target">
1169 <xsl:with-param name="context" select="$this"/>
1170 <xsl:with-param name="object" select="."/>
1171 </xsl:call-template>
1172 </xsl:attribute>
1173 <xsl:attribute name="title">
1174 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1175 </xsl:attribute>
1176 </link>
1177 </xsl:for-each>
1178
1179 <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
1180 <link rel="subsection">
1181 <xsl:attribute name="href">
1182 <xsl:call-template name="href.target">
1183 <xsl:with-param name="context" select="$this"/>
1184 <xsl:with-param name="object" select="."/>
1185 </xsl:call-template>
1186 </xsl:attribute>
1187 <xsl:attribute name="title">
1188 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1189 </xsl:attribute>
1190 </link>
1191 </xsl:for-each>
1192 </xsl:if>
1193
1194 <!-- * if we have a legalnotice and user wants it output as a -->
1195 <!-- * separate page and $html.head.legalnotice.link.types is -->
1196 <!-- * non-empty, we generate a link or links for each value in -->
1197 <!-- * $html.head.legalnotice.link.types -->
1198 <xsl:if test="//legalnotice and not($generate.legalnotice.link = 0) and not($html.head.legalnotice.link.types = '')">
1199 <xsl:call-template name="make.legalnotice.head.links"/>
1200 </xsl:if>
1201
1202 <xsl:call-template name="user.head.content"/>
1203 </head>
1204</xsl:template>
1205
1206<!-- ==================================================================== -->
1207
1208<xsl:template name="header.navigation">
1209 <xsl:param name="prev" select="/foo"/>
1210 <xsl:param name="next" select="/foo"/>
1211 <xsl:param name="nav.context"/>
1212
1213 <xsl:variable name="home" select="/*[1]"/>
1214 <xsl:variable name="up" select="parent::*"/>
1215
1216 <xsl:variable name="row1" select="$navig.showtitles != 0"/>
1217 <xsl:variable name="row2" select="count($prev) &gt; 0 or (count($up) &gt; 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0) or count($next) &gt; 0"/>
1218
1219 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
1220 <div class="navheader">
1221 <xsl:if test="$row1 or $row2">
1222 <table width="100%" summary="Navigation header">
1223 <xsl:if test="$row1">
1224 <tr>
1225 <th colspan="3" align="center">
1226 <xsl:apply-templates select="." mode="object.title.markup"/>
1227 </th>
1228 </tr>
1229 </xsl:if>
1230
1231 <xsl:if test="$row2">
1232 <tr>
1233 <td width="20%" align="{$direction.align.start}">
1234 <xsl:if test="count($prev)&gt;0">
1235 <a accesskey="p">
1236 <xsl:attribute name="href">
1237 <xsl:call-template name="href.target">
1238 <xsl:with-param name="object" select="$prev"/>
1239 </xsl:call-template>
1240 </xsl:attribute>
1241 <xsl:call-template name="navig.content">
1242 <xsl:with-param name="direction" select="'prev'"/>
1243 </xsl:call-template>
1244 </a>
1245 </xsl:if>
1246 <xsl:text>&#160;</xsl:text>
1247 </td>
1248 <th width="60%" align="center">
1249 <xsl:choose>
1250 <xsl:when test="count($up) &gt; 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0">
1251 <xsl:apply-templates select="$up" mode="object.title.markup"/>
1252 </xsl:when>
1253 <xsl:otherwise>&#160;</xsl:otherwise>
1254 </xsl:choose>
1255 </th>
1256 <td width="20%" align="{$direction.align.end}">
1257 <xsl:text>&#160;</xsl:text>
1258 <xsl:if test="count($next)&gt;0">
1259 <a accesskey="n">
1260 <xsl:attribute name="href">
1261 <xsl:call-template name="href.target">
1262 <xsl:with-param name="object" select="$next"/>
1263 </xsl:call-template>
1264 </xsl:attribute>
1265 <xsl:call-template name="navig.content">
1266 <xsl:with-param name="direction" select="'next'"/>
1267 </xsl:call-template>
1268 </a>
1269 </xsl:if>
1270 </td>
1271 </tr>
1272 </xsl:if>
1273 </table>
1274 </xsl:if>
1275 <xsl:if test="$header.rule != 0">
1276 <hr/>
1277 </xsl:if>
1278 </div>
1279 </xsl:if>
1280</xsl:template>
1281
1282<!-- ==================================================================== -->
1283
1284<xsl:template name="footer.navigation">
1285 <xsl:param name="prev" select="/foo"/>
1286 <xsl:param name="next" select="/foo"/>
1287 <xsl:param name="nav.context"/>
1288
1289 <xsl:variable name="home" select="/*[1]"/>
1290 <xsl:variable name="up" select="parent::*"/>
1291
1292 <xsl:variable name="row1" select="count($prev) &gt; 0 or count($up) &gt; 0 or count($next) &gt; 0"/>
1293
1294 <xsl:variable name="row2" select="($prev and $navig.showtitles != 0) or (generate-id($home) != generate-id(.) or $nav.context = 'toc') or ($chunk.tocs.and.lots != 0 and $nav.context != 'toc') or ($next and $navig.showtitles != 0)"/>
1295
1296 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
1297 <div class="navfooter">
1298 <xsl:if test="$footer.rule != 0">
1299 <hr/>
1300 </xsl:if>
1301
1302 <xsl:if test="$row1 or $row2">
1303 <table width="100%" summary="Navigation footer">
1304 <xsl:if test="$row1">
1305 <tr>
1306 <td width="40%" align="{$direction.align.start}">
1307 <xsl:if test="count($prev)&gt;0">
1308 <a accesskey="p">
1309 <xsl:attribute name="href">
1310 <xsl:call-template name="href.target">
1311 <xsl:with-param name="object" select="$prev"/>
1312 </xsl:call-template>
1313 </xsl:attribute>
1314 <xsl:call-template name="navig.content">
1315 <xsl:with-param name="direction" select="'prev'"/>
1316 </xsl:call-template>
1317 </a>
1318 </xsl:if>
1319 <xsl:text>&#160;</xsl:text>
1320 </td>
1321 <td width="20%" align="center">
1322 <xsl:choose>
1323 <xsl:when test="count($up)&gt;0 and generate-id($up) != generate-id($home)">
1324 <a accesskey="u">
1325 <xsl:attribute name="href">
1326 <xsl:call-template name="href.target">
1327 <xsl:with-param name="object" select="$up"/>
1328 </xsl:call-template>
1329 </xsl:attribute>
1330 <xsl:call-template name="navig.content">
1331 <xsl:with-param name="direction" select="'up'"/>
1332 </xsl:call-template>
1333 </a>
1334 </xsl:when>
1335 <xsl:otherwise>&#160;</xsl:otherwise>
1336 </xsl:choose>
1337 </td>
1338 <td width="40%" align="{$direction.align.end}">
1339 <xsl:text>&#160;</xsl:text>
1340 <xsl:if test="count($next)&gt;0">
1341 <a accesskey="n">
1342 <xsl:attribute name="href">
1343 <xsl:call-template name="href.target">
1344 <xsl:with-param name="object" select="$next"/>
1345 </xsl:call-template>
1346 </xsl:attribute>
1347 <xsl:call-template name="navig.content">
1348 <xsl:with-param name="direction" select="'next'"/>
1349 </xsl:call-template>
1350 </a>
1351 </xsl:if>
1352 </td>
1353 </tr>
1354 </xsl:if>
1355
1356 <xsl:if test="$row2">
1357 <tr>
1358 <td width="40%" align="{$direction.align.start}" valign="top">
1359 <xsl:if test="$navig.showtitles != 0">
1360 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
1361 </xsl:if>
1362 <xsl:text>&#160;</xsl:text>
1363 </td>
1364 <td width="20%" align="center">
1365 <xsl:choose>
1366 <xsl:when test="$home != . or $nav.context = 'toc'">
1367 <a accesskey="h">
1368 <xsl:attribute name="href">
1369 <xsl:call-template name="href.target">
1370 <xsl:with-param name="object" select="$home"/>
1371 </xsl:call-template>
1372 </xsl:attribute>
1373 <xsl:call-template name="navig.content">
1374 <xsl:with-param name="direction" select="'home'"/>
1375 </xsl:call-template>
1376 </a>
1377 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1378 <xsl:text>&#160;|&#160;</xsl:text>
1379 </xsl:if>
1380 </xsl:when>
1381 <xsl:otherwise>&#160;</xsl:otherwise>
1382 </xsl:choose>
1383
1384 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1385 <a accesskey="t">
1386 <xsl:attribute name="href">
1387 <xsl:value-of select="$chunked.filename.prefix"/>
1388 <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
1389 <xsl:with-param name="recursive" select="true()"/>
1390 </xsl:apply-templates>
1391 <xsl:text>-toc</xsl:text>
1392 <xsl:value-of select="$html.ext"/>
1393 </xsl:attribute>
1394 <xsl:call-template name="gentext">
1395 <xsl:with-param name="key" select="'nav-toc'"/>
1396 </xsl:call-template>
1397 </a>
1398 </xsl:if>
1399 </td>
1400 <td width="40%" align="{$direction.align.end}" valign="top">
1401 <xsl:text>&#160;</xsl:text>
1402 <xsl:if test="$navig.showtitles != 0">
1403 <xsl:apply-templates select="$next" mode="object.title.markup"/>
1404 </xsl:if>
1405 </td>
1406 </tr>
1407 </xsl:if>
1408 </table>
1409 </xsl:if>
1410 </div>
1411 </xsl:if>
1412</xsl:template>
1413
1414<!-- ==================================================================== -->
1415
1416<xsl:template name="navig.content">
1417 <xsl:param name="direction" select="next"/>
1418 <xsl:variable name="navtext">
1419 <xsl:choose>
1420 <xsl:when test="$direction = 'prev'">
1421 <xsl:call-template name="gentext.nav.prev"/>
1422 </xsl:when>
1423 <xsl:when test="$direction = 'next'">
1424 <xsl:call-template name="gentext.nav.next"/>
1425 </xsl:when>
1426 <xsl:when test="$direction = 'up'">
1427 <xsl:call-template name="gentext.nav.up"/>
1428 </xsl:when>
1429 <xsl:when test="$direction = 'home'">
1430 <xsl:call-template name="gentext.nav.home"/>
1431 </xsl:when>
1432 <xsl:otherwise>
1433 <xsl:text>xxx</xsl:text>
1434 </xsl:otherwise>
1435 </xsl:choose>
1436 </xsl:variable>
1437
1438 <xsl:choose>
1439 <xsl:when test="$navig.graphics != 0">
1440 <img>
1441 <xsl:attribute name="src">
1442 <xsl:value-of select="$navig.graphics.path"/>
1443 <xsl:value-of select="$direction"/>
1444 <xsl:value-of select="$navig.graphics.extension"/>
1445 </xsl:attribute>
1446 <xsl:attribute name="alt">
1447 <xsl:value-of select="$navtext"/>
1448 </xsl:attribute>
1449 </img>
1450 </xsl:when>
1451 <xsl:otherwise>
1452 <xsl:value-of select="$navtext"/>
1453 </xsl:otherwise>
1454 </xsl:choose>
1455</xsl:template>
1456
1457<!-- ==================================================================== -->
1458
1459<!-- * The following template assumes that the first legalnotice -->
1460<!-- * instance found in a document applies to the contents of the -->
1461<!-- * entire document. It generates an HTML link in each chunk, back -->
1462<!-- * to the file containing the contents of the first legalnotice. -->
1463<!-- * -->
1464<!-- * Actually, it may generate multiple link instances in each chunk, -->
1465<!-- * because it walks through the space-separated list of link -->
1466<!-- * types specified in the $html.head.legalnotice.link.types param, -->
1467<!-- * popping off link types and generating links for them until it -->
1468<!-- * depletes the list. -->
1469
1470<xsl:template name="make.legalnotice.head.links">
1471 <!-- * the following ID is used as part of the legalnotice filename; -->
1472 <!-- * we need it in order to construct the filename for use in the -->
1473 <!-- * value of the href attribute on the link -->
1474
1475 <xsl:param name="ln-node" select="(//legalnotice)[1]"/>
1476
1477 <xsl:param name="linktype">
1478 <xsl:choose>
1479 <xsl:when test="contains($html.head.legalnotice.link.types, ' ')">
1480 <xsl:value-of select="normalize-space( substring-before($html.head.legalnotice.link.types, ' '))"/>
1481 </xsl:when>
1482 <xsl:otherwise>
1483 <xsl:value-of select="$html.head.legalnotice.link.types"/>
1484 </xsl:otherwise>
1485 </xsl:choose>
1486 </xsl:param>
1487 <xsl:param name="remaining.linktypes" select="concat( normalize-space( substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
1488 <xsl:if test="not($linktype = '')">
1489
1490 <!-- Compute name of legalnotice file (see titlepage.xsl) -->
1491 <xsl:variable name="file">
1492 <xsl:call-template name="ln.or.rh.filename">
1493 <xsl:with-param name="node" select="$ln-node"/>
1494 </xsl:call-template>
1495 </xsl:variable>
1496
1497 <link rel="{$linktype}">
1498 <xsl:attribute name="href">
1499 <xsl:value-of select="$file"/>
1500 </xsl:attribute>
1501 <xsl:attribute name="title">
1502 <xsl:apply-templates select="(//legalnotice)[1]" mode="object.title.markup.textonly"/>
1503 </xsl:attribute>
1504 </link>
1505 <xsl:call-template name="make.legalnotice.head.links">
1506 <!-- * pop the next value off the list of link types -->
1507 <xsl:with-param name="linktype" select="substring-before($remaining.linktypes, ' ')"/>
1508 <!-- * remove the link type from the list of remaining link types -->
1509 <xsl:with-param name="remaining.linktypes" select="substring-after($remaining.linktypes, ' ')"/>
1510 </xsl:call-template>
1511 </xsl:if>
1512</xsl:template>
1513
1514<!-- ==================================================================== -->
1515<xsl:template name="chunk-element-content">
1516 <xsl:param name="prev"/>
1517 <xsl:param name="next"/>
1518 <xsl:param name="nav.context"/>
1519 <xsl:param name="content">
1520 <xsl:apply-imports/>
1521 </xsl:param>
1522
1523 <xsl:call-template name="user.preroot"/>
1524
1525 <html>
1526 <xsl:call-template name="root.attributes"/>
1527 <xsl:call-template name="html.head">
1528 <xsl:with-param name="prev" select="$prev"/>
1529 <xsl:with-param name="next" select="$next"/>
1530 </xsl:call-template>
1531
1532 <body>
1533 <xsl:call-template name="body.attributes"/>
1534
1535 <xsl:call-template name="user.header.navigation">
1536 <xsl:with-param name="prev" select="$prev"/>
1537 <xsl:with-param name="next" select="$next"/>
1538 <xsl:with-param name="nav.context" select="$nav.context"/>
1539 </xsl:call-template>
1540
1541 <xsl:call-template name="header.navigation">
1542 <xsl:with-param name="prev" select="$prev"/>
1543 <xsl:with-param name="next" select="$next"/>
1544 <xsl:with-param name="nav.context" select="$nav.context"/>
1545 </xsl:call-template>
1546
1547 <xsl:call-template name="user.header.content"/>
1548
1549 <xsl:copy-of select="$content"/>
1550
1551 <xsl:call-template name="user.footer.content"/>
1552
1553 <xsl:call-template name="footer.navigation">
1554 <xsl:with-param name="prev" select="$prev"/>
1555 <xsl:with-param name="next" select="$next"/>
1556 <xsl:with-param name="nav.context" select="$nav.context"/>
1557 </xsl:call-template>
1558
1559 <xsl:call-template name="user.footer.navigation">
1560 <xsl:with-param name="prev" select="$prev"/>
1561 <xsl:with-param name="next" select="$next"/>
1562 <xsl:with-param name="nav.context" select="$nav.context"/>
1563 </xsl:call-template>
1564 </body>
1565 </html>
1566 <xsl:value-of select="$chunk.append"/>
1567</xsl:template>
1568
1569<!-- ==================================================================== -->
1570<xsl:template name="generate.manifest">
1571 <xsl:param name="node" select="/"/>
1572 <xsl:call-template name="write.text.chunk">
1573 <xsl:with-param name="filename">
1574 <xsl:if test="$manifest.in.base.dir != 0">
1575 <xsl:value-of select="$chunk.base.dir"/>
1576 </xsl:if>
1577 <xsl:value-of select="$manifest"/>
1578 </xsl:with-param>
1579 <xsl:with-param name="method" select="'text'"/>
1580 <xsl:with-param name="content">
1581 <xsl:apply-templates select="$node" mode="enumerate-files"/>
1582 </xsl:with-param>
1583 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
1584 </xsl:call-template>
1585</xsl:template>
1586
1587<!-- ==================================================================== -->
1588
1589<xsl:template name="dbhtml-dir">
1590 <xsl:param name="context" select="."/>
1591 <!-- directories are now inherited from previous levels -->
1592 <xsl:variable name="ppath">
1593 <xsl:if test="$context/parent::*">
1594 <xsl:call-template name="dbhtml-dir">
1595 <xsl:with-param name="context" select="$context/parent::*"/>
1596 </xsl:call-template>
1597 </xsl:if>
1598 </xsl:variable>
1599 <xsl:variable name="path">
1600 <xsl:call-template name="pi.dbhtml_dir">
1601 <xsl:with-param name="node" select="$context"/>
1602 </xsl:call-template>
1603 </xsl:variable>
1604 <xsl:choose>
1605 <xsl:when test="$path = ''">
1606 <xsl:if test="$ppath != ''">
1607 <xsl:value-of select="$ppath"/>
1608 </xsl:if>
1609 </xsl:when>
1610 <xsl:otherwise>
1611 <xsl:if test="$ppath != ''">
1612 <xsl:value-of select="$ppath"/>
1613 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
1614 <xsl:text>/</xsl:text>
1615 </xsl:if>
1616 </xsl:if>
1617 <xsl:value-of select="$path"/>
1618 <xsl:text>/</xsl:text>
1619 </xsl:otherwise>
1620 </xsl:choose>
1621</xsl:template>
1622
1623</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.