| 1 |
<?xml version='1.0'?> |
| 2 |
<xsl:stylesheet exclude-result-prefixes="d" |
| 3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 4 |
xmlns:d="http://docbook.org/ns/docbook" |
| 5 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" |
| 6 |
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions" |
| 7 |
version='1.0'> |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
<xsl:template name="set.toc"> |
| 20 |
|
| 21 |
<xsl:param name="toc-context" select="."/> |
| 22 |
|
| 23 |
<xsl:variable name="id"> |
| 24 |
<xsl:call-template name="object.id"/> |
| 25 |
</xsl:variable> |
| 26 |
|
| 27 |
<xsl:variable name="cid"> |
| 28 |
<xsl:call-template name="object.id"> |
| 29 |
<xsl:with-param name="object" select="$toc-context"/> |
| 30 |
</xsl:call-template> |
| 31 |
</xsl:variable> |
| 32 |
|
| 33 |
<xsl:variable name="nodes" select="d:book|d:set|d:setindex|d:article"/> |
| 34 |
|
| 35 |
<xsl:if test="$nodes"> |
| 36 |
<fo:block id="toc...{$id}" |
| 37 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 38 |
<xsl:if test="$axf.extensions != 0 and |
| 39 |
$xsl1.1.bookmarks = 0 and |
| 40 |
$show.bookmarks != 0"> |
| 41 |
<xsl:attribute name="axf:outline-level">1</xsl:attribute> |
| 42 |
<xsl:attribute name="axf:outline-expand">false</xsl:attribute> |
| 43 |
<xsl:attribute name="axf:outline-title"> |
| 44 |
<xsl:call-template name="gentext"> |
| 45 |
<xsl:with-param name="key" select="'TableofContents'"/> |
| 46 |
</xsl:call-template> |
| 47 |
</xsl:attribute> |
| 48 |
</xsl:if> |
| 49 |
<xsl:call-template name="table.of.contents.titlepage"/> |
| 50 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 51 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 52 |
</xsl:apply-templates> |
| 53 |
</fo:block> |
| 54 |
</xsl:if> |
| 55 |
</xsl:template> |
| 56 |
|
| 57 |
<xsl:template name="division.toc"> |
| 58 |
<xsl:param name="toc-context" select="."/> |
| 59 |
<xsl:param name="toc.title.p" select="true()"/> |
| 60 |
|
| 61 |
<xsl:variable name="cid"> |
| 62 |
<xsl:call-template name="object.id"> |
| 63 |
<xsl:with-param name="object" select="$toc-context"/> |
| 64 |
</xsl:call-template> |
| 65 |
</xsl:variable> |
| 66 |
|
| 67 |
<xsl:variable name="nodes" |
| 68 |
select="$toc-context/d:part |
| 69 |
|$toc-context/d:reference |
| 70 |
|$toc-context/d:preface |
| 71 |
|$toc-context/d:chapter |
| 72 |
|$toc-context/d:appendix |
| 73 |
|$toc-context/d:article |
| 74 |
|$toc-context/d:topic |
| 75 |
|$toc-context/d:bibliography |
| 76 |
|$toc-context/d:glossary |
| 77 |
|$toc-context/d:index"/> |
| 78 |
|
| 79 |
<xsl:if test="$nodes"> |
| 80 |
<fo:block id="toc...{$cid}" |
| 81 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 82 |
<xsl:if test="$axf.extensions != 0 and |
| 83 |
$xsl1.1.bookmarks = 0 and |
| 84 |
$show.bookmarks != 0"> |
| 85 |
<xsl:attribute name="axf:outline-level">1</xsl:attribute> |
| 86 |
<xsl:attribute name="axf:outline-expand">false</xsl:attribute> |
| 87 |
<xsl:attribute name="axf:outline-title"> |
| 88 |
<xsl:call-template name="gentext"> |
| 89 |
<xsl:with-param name="key" select="'TableofContents'"/> |
| 90 |
</xsl:call-template> |
| 91 |
</xsl:attribute> |
| 92 |
</xsl:if> |
| 93 |
<xsl:if test="$toc.title.p"> |
| 94 |
<xsl:call-template name="table.of.contents.titlepage"/> |
| 95 |
</xsl:if> |
| 96 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 97 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 98 |
</xsl:apply-templates> |
| 99 |
</fo:block> |
| 100 |
</xsl:if> |
| 101 |
</xsl:template> |
| 102 |
|
| 103 |
<xsl:template name="component.toc"> |
| 104 |
<xsl:param name="toc-context" select="."/> |
| 105 |
<xsl:param name="toc.title.p" select="true()"/> |
| 106 |
|
| 107 |
<xsl:variable name="id"> |
| 108 |
<xsl:call-template name="object.id"/> |
| 109 |
</xsl:variable> |
| 110 |
|
| 111 |
<xsl:variable name="cid"> |
| 112 |
<xsl:call-template name="object.id"> |
| 113 |
<xsl:with-param name="object" select="$toc-context"/> |
| 114 |
</xsl:call-template> |
| 115 |
</xsl:variable> |
| 116 |
|
| 117 |
<xsl:variable name="nodes" select="d:section|d:sect1|d:refentry |
| 118 |
|d:article|d:topic|d:bibliography|d:glossary |
| 119 |
|d:qandaset[$qanda.in.toc != 0] |
| 120 |
|d:appendix|d:index"/> |
| 121 |
<xsl:if test="$nodes"> |
| 122 |
<fo:block id="toc...{$id}" |
| 123 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 124 |
<xsl:if test="$toc.title.p"> |
| 125 |
<xsl:call-template name="table.of.contents.titlepage"/> |
| 126 |
</xsl:if> |
| 127 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 128 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 129 |
</xsl:apply-templates> |
| 130 |
</fo:block> |
| 131 |
</xsl:if> |
| 132 |
</xsl:template> |
| 133 |
|
| 134 |
<xsl:template name="component.toc.separator"> |
| 135 |
|
| 136 |
|
| 137 |
</xsl:template> |
| 138 |
|
| 139 |
<xsl:template name="section.toc"> |
| 140 |
<xsl:param name="toc-context" select="."/> |
| 141 |
<xsl:param name="toc.title.p" select="true()"/> |
| 142 |
|
| 143 |
<xsl:variable name="id"> |
| 144 |
<xsl:call-template name="object.id"/> |
| 145 |
</xsl:variable> |
| 146 |
|
| 147 |
<xsl:variable name="cid"> |
| 148 |
<xsl:call-template name="object.id"> |
| 149 |
<xsl:with-param name="object" select="$toc-context"/> |
| 150 |
</xsl:call-template> |
| 151 |
</xsl:variable> |
| 152 |
|
| 153 |
<xsl:variable name="nodes" |
| 154 |
select="d:section|d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:refentry |
| 155 |
|d:qandaset[$qanda.in.toc != 0] |
| 156 |
|d:bridgehead[$bridgehead.in.toc != 0]"/> |
| 157 |
|
| 158 |
<xsl:variable name="level"> |
| 159 |
<xsl:call-template name="section.level"/> |
| 160 |
</xsl:variable> |
| 161 |
|
| 162 |
<xsl:if test="$nodes"> |
| 163 |
<fo:block id="toc...{$id}" |
| 164 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 165 |
|
| 166 |
<xsl:if test="$toc.title.p"> |
| 167 |
<xsl:call-template name="section.heading"> |
| 168 |
<xsl:with-param name="level" select="$level + 1"/> |
| 169 |
<xsl:with-param name="title"> |
| 170 |
<fo:block space-after="0.5em"> |
| 171 |
<xsl:call-template name="gentext"> |
| 172 |
<xsl:with-param name="key" select="'TableofContents'"/> |
| 173 |
</xsl:call-template> |
| 174 |
</fo:block> |
| 175 |
</xsl:with-param> |
| 176 |
</xsl:call-template> |
| 177 |
</xsl:if> |
| 178 |
|
| 179 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 180 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 181 |
</xsl:apply-templates> |
| 182 |
</fo:block> |
| 183 |
</xsl:if> |
| 184 |
</xsl:template> |
| 185 |
|
| 186 |
<xsl:template name="section.toc.separator"> |
| 187 |
|
| 188 |
|
| 189 |
</xsl:template> |
| 190 |
|
| 191 |
|
| 192 |
<xsl:template name="toc.line"> |
| 193 |
<xsl:param name="toc-context" select="NOTANODE"/> |
| 194 |
|
| 195 |
<xsl:variable name="id"> |
| 196 |
<xsl:call-template name="object.id"/> |
| 197 |
</xsl:variable> |
| 198 |
|
| 199 |
<xsl:variable name="label"> |
| 200 |
<xsl:apply-templates select="." mode="label.markup"/> |
| 201 |
</xsl:variable> |
| 202 |
|
| 203 |
<fo:block xsl:use-attribute-sets="toc.line.properties"> |
| 204 |
<fo:inline keep-with-next.within-line="always"> |
| 205 |
<fo:basic-link internal-destination="{$id}"> |
| 206 |
<xsl:if test="$label != ''"> |
| 207 |
<xsl:copy-of select="$label"/> |
| 208 |
<xsl:value-of select="$autotoc.label.separator"/> |
| 209 |
</xsl:if> |
| 210 |
<xsl:apply-templates select="." mode="titleabbrev.markup"/> |
| 211 |
</fo:basic-link> |
| 212 |
</fo:inline> |
| 213 |
<fo:inline keep-together.within-line="always"> |
| 214 |
<fo:leader xsl:use-attribute-sets="toc.leader.properties"/> |
| 215 |
<fo:basic-link internal-destination="{$id}"> |
| 216 |
<fo:page-number-citation ref-id="{$id}"/> |
| 217 |
</fo:basic-link> |
| 218 |
</fo:inline> |
| 219 |
</fo:block> |
| 220 |
</xsl:template> |
| 221 |
|
| 222 |
|
| 223 |
<xsl:template name="qandaset.toc"> |
| 224 |
<xsl:param name="toc-context" select="."/> |
| 225 |
<xsl:param name="toc.title.p" select="true()"/> |
| 226 |
|
| 227 |
<xsl:variable name="id"> |
| 228 |
<xsl:call-template name="object.id"/> |
| 229 |
</xsl:variable> |
| 230 |
|
| 231 |
<xsl:variable name="cid"> |
| 232 |
<xsl:call-template name="object.id"> |
| 233 |
<xsl:with-param name="object" select="$toc-context"/> |
| 234 |
</xsl:call-template> |
| 235 |
</xsl:variable> |
| 236 |
|
| 237 |
<xsl:variable name="nodes" select="d:qandadiv|d:qandaentry"/> |
| 238 |
|
| 239 |
<xsl:if test="$nodes"> |
| 240 |
<fo:block id="toc...{$id}" |
| 241 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 242 |
<xsl:if test="$toc.title.p"> |
| 243 |
<xsl:call-template name="table.of.contents.titlepage"/> |
| 244 |
</xsl:if> |
| 245 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 246 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 247 |
</xsl:apply-templates> |
| 248 |
</fo:block> |
| 249 |
</xsl:if> |
| 250 |
</xsl:template> |
| 251 |
|
| 252 |
<xsl:template name="qandaset.toc.separator"> |
| 253 |
|
| 254 |
|
| 255 |
</xsl:template> |
| 256 |
|
| 257 |
<xsl:template match="d:qandadiv" mode="toc"> |
| 258 |
<xsl:param name="toc-context" select="."/> |
| 259 |
|
| 260 |
<xsl:variable name="id"> |
| 261 |
<xsl:call-template name="object.id"/> |
| 262 |
</xsl:variable> |
| 263 |
|
| 264 |
<xsl:variable name="cid"> |
| 265 |
<xsl:call-template name="object.id"> |
| 266 |
<xsl:with-param name="object" select="$toc-context"/> |
| 267 |
</xsl:call-template> |
| 268 |
</xsl:variable> |
| 269 |
|
| 270 |
<xsl:call-template name="toc.line"> |
| 271 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 272 |
</xsl:call-template> |
| 273 |
|
| 274 |
<xsl:variable name="nodes" select="d:qandadiv|d:qandaentry"/> |
| 275 |
|
| 276 |
<xsl:if test="$nodes"> |
| 277 |
<fo:block id="toc.{$cid}.{$id}"> |
| 278 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 279 |
<xsl:call-template name="set.toc.indent"/> |
| 280 |
</xsl:attribute> |
| 281 |
|
| 282 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 283 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 284 |
</xsl:apply-templates> |
| 285 |
</fo:block> |
| 286 |
</xsl:if> |
| 287 |
</xsl:template> |
| 288 |
|
| 289 |
<xsl:template match="d:qandaentry" mode="toc"> |
| 290 |
<xsl:apply-templates select="d:question" mode="toc"/> |
| 291 |
</xsl:template> |
| 292 |
|
| 293 |
<xsl:template match="d:question" mode="toc"> |
| 294 |
<xsl:variable name="firstchunk"> |
| 295 |
|
| 296 |
<xsl:choose> |
| 297 |
<xsl:when test="../d:blockinfo/d:titleabbrev"> |
| 298 |
<xsl:apply-templates select="../d:blockinfo/d:titleabbrev[1]/node()"/> |
| 299 |
</xsl:when> |
| 300 |
<xsl:when test="../d:blockinfo/d:title"> |
| 301 |
<xsl:apply-templates select="../d:blockinfo/d:title[1]/node()"/> |
| 302 |
</xsl:when> |
| 303 |
<xsl:when test="../d:info/d:titleabbrev"> |
| 304 |
<xsl:apply-templates select="../d:info/d:titleabbrev[1]/node()"/> |
| 305 |
</xsl:when> |
| 306 |
<xsl:when test="../d:titleabbrev"> |
| 307 |
<xsl:apply-templates select="../d:titleabbrev[1]/node()"/> |
| 308 |
</xsl:when> |
| 309 |
<xsl:when test="../d:info/d:title"> |
| 310 |
<xsl:apply-templates select="../d:info/d:title[1]/node()"/> |
| 311 |
</xsl:when> |
| 312 |
<xsl:when test="../d:title"> |
| 313 |
<xsl:apply-templates select="../d:title[1]/node()"/> |
| 314 |
</xsl:when> |
| 315 |
<xsl:otherwise> |
| 316 |
<xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/> |
| 317 |
</xsl:otherwise> |
| 318 |
</xsl:choose> |
| 319 |
</xsl:variable> |
| 320 |
|
| 321 |
<xsl:variable name="deflabel"> |
| 322 |
<xsl:choose> |
| 323 |
<xsl:when test="ancestor-or-self::*[@defaultlabel]"> |
| 324 |
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] |
| 325 |
/@defaultlabel"/> |
| 326 |
</xsl:when> |
| 327 |
<xsl:otherwise> |
| 328 |
<xsl:value-of select="$qanda.defaultlabel"/> |
| 329 |
</xsl:otherwise> |
| 330 |
</xsl:choose> |
| 331 |
</xsl:variable> |
| 332 |
|
| 333 |
<xsl:variable name="id"> |
| 334 |
<xsl:call-template name="object.id"/> |
| 335 |
</xsl:variable> |
| 336 |
|
| 337 |
<xsl:variable name="label"> |
| 338 |
<xsl:apply-templates select="." mode="label.markup"/> |
| 339 |
</xsl:variable> |
| 340 |
|
| 341 |
<fo:block xsl:use-attribute-sets="toc.line.properties" |
| 342 |
end-indent="{$toc.indent.width}pt" |
| 343 |
last-line-end-indent="-{$toc.indent.width}pt"> |
| 344 |
<xsl:attribute name="margin-{$direction.align.start}">3em</xsl:attribute> |
| 345 |
<xsl:attribute name="text-indent">-3em</xsl:attribute> |
| 346 |
<fo:inline keep-with-next.within-line="always"> |
| 347 |
<fo:basic-link internal-destination="{$id}"> |
| 348 |
<xsl:if test="$label != ''"> |
| 349 |
<xsl:copy-of select="$label"/> |
| 350 |
<xsl:if test="$deflabel = 'number' and not(d:label)"> |
| 351 |
<xsl:value-of select="$autotoc.label.separator"/> |
| 352 |
</xsl:if> |
| 353 |
<xsl:text> </xsl:text> |
| 354 |
</xsl:if> |
| 355 |
<xsl:copy-of select="$firstchunk"/> |
| 356 |
</fo:basic-link> |
| 357 |
</fo:inline> |
| 358 |
<fo:inline keep-together.within-line="always"> |
| 359 |
<fo:leader xsl:use-attribute-sets="toc.leader.properties"/> |
| 360 |
<fo:basic-link internal-destination="{$id}"> |
| 361 |
<fo:page-number-citation ref-id="{$id}"/> |
| 362 |
</fo:basic-link> |
| 363 |
</fo:inline> |
| 364 |
</fo:block> |
| 365 |
|
| 366 |
</xsl:template> |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
<xsl:template match="d:book|d:setindex" mode="toc"> |
| 371 |
<xsl:param name="toc-context" select="."/> |
| 372 |
|
| 373 |
<xsl:variable name="id"> |
| 374 |
<xsl:call-template name="object.id"/> |
| 375 |
</xsl:variable> |
| 376 |
|
| 377 |
<xsl:variable name="cid"> |
| 378 |
<xsl:call-template name="object.id"> |
| 379 |
<xsl:with-param name="object" select="$toc-context"/> |
| 380 |
</xsl:call-template> |
| 381 |
</xsl:variable> |
| 382 |
|
| 383 |
<xsl:call-template name="toc.line"> |
| 384 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 385 |
</xsl:call-template> |
| 386 |
|
| 387 |
<xsl:variable name="nodes" select="d:glossary|d:bibliography|d:preface|d:chapter |
| 388 |
|d:reference|d:part|d:article|d:topic|d:appendix|d:index"/> |
| 389 |
|
| 390 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 391 |
|
| 392 |
<xsl:if test="$toc.max.depth > $depth.from.context |
| 393 |
and $nodes"> |
| 394 |
<fo:block id="toc.{$cid}.{$id}"> |
| 395 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 396 |
<xsl:call-template name="set.toc.indent"/> |
| 397 |
</xsl:attribute> |
| 398 |
|
| 399 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 400 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 401 |
</xsl:apply-templates> |
| 402 |
</fo:block> |
| 403 |
</xsl:if> |
| 404 |
</xsl:template> |
| 405 |
|
| 406 |
<xsl:template match="d:set" mode="toc"> |
| 407 |
<xsl:param name="toc-context" select="."/> |
| 408 |
|
| 409 |
<xsl:variable name="id"> |
| 410 |
<xsl:call-template name="object.id"/> |
| 411 |
</xsl:variable> |
| 412 |
|
| 413 |
<xsl:variable name="cid"> |
| 414 |
<xsl:call-template name="object.id"> |
| 415 |
<xsl:with-param name="object" select="$toc-context"/> |
| 416 |
</xsl:call-template> |
| 417 |
</xsl:variable> |
| 418 |
|
| 419 |
<xsl:call-template name="toc.line"> |
| 420 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 421 |
</xsl:call-template> |
| 422 |
|
| 423 |
<xsl:variable name="nodes" select="d:set|d:book|d:setindex|d:article"/> |
| 424 |
|
| 425 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 426 |
|
| 427 |
<xsl:if test="$toc.max.depth > $depth.from.context |
| 428 |
and $nodes"> |
| 429 |
<fo:block id="toc.{$cid}.{$id}"> |
| 430 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 431 |
<xsl:call-template name="set.toc.indent"/> |
| 432 |
</xsl:attribute> |
| 433 |
|
| 434 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 435 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 436 |
</xsl:apply-templates> |
| 437 |
</fo:block> |
| 438 |
</xsl:if> |
| 439 |
</xsl:template> |
| 440 |
|
| 441 |
<xsl:template match="d:part" mode="toc"> |
| 442 |
<xsl:param name="toc-context" select="."/> |
| 443 |
|
| 444 |
<xsl:variable name="id"> |
| 445 |
<xsl:call-template name="object.id"/> |
| 446 |
</xsl:variable> |
| 447 |
|
| 448 |
<xsl:variable name="cid"> |
| 449 |
<xsl:call-template name="object.id"> |
| 450 |
<xsl:with-param name="object" select="$toc-context"/> |
| 451 |
</xsl:call-template> |
| 452 |
</xsl:variable> |
| 453 |
|
| 454 |
<xsl:call-template name="toc.line"> |
| 455 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 456 |
</xsl:call-template> |
| 457 |
|
| 458 |
<xsl:variable name="nodes" select="d:chapter|d:appendix|d:preface|d:reference| |
| 459 |
d:refentry|d:article|d:topic|d:index|d:glossary| |
| 460 |
d:bibliography"/> |
| 461 |
|
| 462 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 463 |
|
| 464 |
<xsl:if test="$toc.max.depth > $depth.from.context |
| 465 |
and $nodes"> |
| 466 |
<fo:block id="toc.{$cid}.{$id}"> |
| 467 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 468 |
<xsl:call-template name="set.toc.indent"/> |
| 469 |
</xsl:attribute> |
| 470 |
|
| 471 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 472 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 473 |
</xsl:apply-templates> |
| 474 |
</fo:block> |
| 475 |
</xsl:if> |
| 476 |
</xsl:template> |
| 477 |
|
| 478 |
<xsl:template match="d:reference" mode="toc"> |
| 479 |
<xsl:param name="toc-context" select="."/> |
| 480 |
|
| 481 |
<xsl:variable name="id"> |
| 482 |
<xsl:call-template name="object.id"/> |
| 483 |
</xsl:variable> |
| 484 |
|
| 485 |
<xsl:variable name="cid"> |
| 486 |
<xsl:call-template name="object.id"> |
| 487 |
<xsl:with-param name="object" select="$toc-context"/> |
| 488 |
</xsl:call-template> |
| 489 |
</xsl:variable> |
| 490 |
|
| 491 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 492 |
|
| 493 |
<xsl:call-template name="toc.line"> |
| 494 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 495 |
</xsl:call-template> |
| 496 |
|
| 497 |
<xsl:if test="$toc.section.depth > 0 |
| 498 |
and $toc.max.depth > $depth.from.context |
| 499 |
and d:refentry"> |
| 500 |
<fo:block id="toc.{$cid}.{$id}"> |
| 501 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 502 |
<xsl:call-template name="set.toc.indent"/> |
| 503 |
</xsl:attribute> |
| 504 |
|
| 505 |
<xsl:apply-templates select="d:refentry" mode="toc"> |
| 506 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 507 |
</xsl:apply-templates> |
| 508 |
</fo:block> |
| 509 |
</xsl:if> |
| 510 |
</xsl:template> |
| 511 |
|
| 512 |
<xsl:template match="d:refentry" mode="toc"> |
| 513 |
<xsl:param name="toc-context" select="."/> |
| 514 |
|
| 515 |
<xsl:call-template name="toc.line"> |
| 516 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 517 |
</xsl:call-template> |
| 518 |
</xsl:template> |
| 519 |
|
| 520 |
<xsl:template match="d:preface|d:chapter|d:appendix|d:article" |
| 521 |
mode="toc"> |
| 522 |
<xsl:param name="toc-context" select="."/> |
| 523 |
|
| 524 |
<xsl:variable name="id"> |
| 525 |
<xsl:call-template name="object.id"/> |
| 526 |
</xsl:variable> |
| 527 |
|
| 528 |
<xsl:variable name="cid"> |
| 529 |
<xsl:call-template name="object.id"> |
| 530 |
<xsl:with-param name="object" select="$toc-context"/> |
| 531 |
</xsl:call-template> |
| 532 |
</xsl:variable> |
| 533 |
|
| 534 |
<xsl:call-template name="toc.line"> |
| 535 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 536 |
</xsl:call-template> |
| 537 |
|
| 538 |
<xsl:variable name="nodes" select="d:section|d:sect1 |
| 539 |
|d:qandaset[$qanda.in.toc != 0] |
| 540 |
|d:simplesect[$simplesect.in.toc != 0] |
| 541 |
|d:topic |
| 542 |
|d:refentry|d:appendix"/> |
| 543 |
|
| 544 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 545 |
|
| 546 |
<xsl:if test="$toc.section.depth > 0 |
| 547 |
and $toc.max.depth > $depth.from.context |
| 548 |
and $nodes"> |
| 549 |
<fo:block id="toc.{$cid}.{$id}"> |
| 550 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 551 |
<xsl:call-template name="set.toc.indent"/> |
| 552 |
</xsl:attribute> |
| 553 |
|
| 554 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 555 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 556 |
</xsl:apply-templates> |
| 557 |
</fo:block> |
| 558 |
</xsl:if> |
| 559 |
</xsl:template> |
| 560 |
|
| 561 |
<xsl:template match="d:sect1" mode="toc"> |
| 562 |
<xsl:param name="toc-context" select="."/> |
| 563 |
|
| 564 |
<xsl:variable name="id"> |
| 565 |
<xsl:call-template name="object.id"/> |
| 566 |
</xsl:variable> |
| 567 |
|
| 568 |
<xsl:variable name="cid"> |
| 569 |
<xsl:call-template name="object.id"> |
| 570 |
<xsl:with-param name="object" select="$toc-context"/> |
| 571 |
</xsl:call-template> |
| 572 |
</xsl:variable> |
| 573 |
|
| 574 |
<xsl:call-template name="toc.line"> |
| 575 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 576 |
</xsl:call-template> |
| 577 |
|
| 578 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 579 |
|
| 580 |
<xsl:if test="$toc.section.depth > 1 |
| 581 |
and $toc.max.depth > $depth.from.context |
| 582 |
and d:sect2"> |
| 583 |
<fo:block id="toc.{$cid}.{$id}"> |
| 584 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 585 |
<xsl:call-template name="set.toc.indent"/> |
| 586 |
</xsl:attribute> |
| 587 |
|
| 588 |
<xsl:apply-templates select="d:sect2|d:qandaset[$qanda.in.toc != 0]" |
| 589 |
mode="toc"> |
| 590 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 591 |
</xsl:apply-templates> |
| 592 |
</fo:block> |
| 593 |
</xsl:if> |
| 594 |
</xsl:template> |
| 595 |
|
| 596 |
<xsl:template match="d:sect2" mode="toc"> |
| 597 |
<xsl:param name="toc-context" select="."/> |
| 598 |
|
| 599 |
<xsl:variable name="id"> |
| 600 |
<xsl:call-template name="object.id"/> |
| 601 |
</xsl:variable> |
| 602 |
|
| 603 |
<xsl:variable name="cid"> |
| 604 |
<xsl:call-template name="object.id"> |
| 605 |
<xsl:with-param name="object" select="$toc-context"/> |
| 606 |
</xsl:call-template> |
| 607 |
</xsl:variable> |
| 608 |
|
| 609 |
<xsl:call-template name="toc.line"> |
| 610 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 611 |
</xsl:call-template> |
| 612 |
|
| 613 |
<xsl:variable name="reldepth" |
| 614 |
select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 615 |
|
| 616 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 617 |
|
| 618 |
<xsl:if test="$toc.section.depth > 2 |
| 619 |
and $toc.max.depth > $depth.from.context |
| 620 |
and d:sect3"> |
| 621 |
<fo:block id="toc.{$cid}.{$id}"> |
| 622 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 623 |
<xsl:call-template name="set.toc.indent"> |
| 624 |
<xsl:with-param name="reldepth" select="$reldepth"/> |
| 625 |
</xsl:call-template> |
| 626 |
</xsl:attribute> |
| 627 |
|
| 628 |
<xsl:apply-templates select="d:sect3|d:qandaset[$qanda.in.toc != 0]" |
| 629 |
mode="toc"> |
| 630 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 631 |
</xsl:apply-templates> |
| 632 |
</fo:block> |
| 633 |
</xsl:if> |
| 634 |
</xsl:template> |
| 635 |
|
| 636 |
<xsl:template match="d:sect3" mode="toc"> |
| 637 |
<xsl:param name="toc-context" select="."/> |
| 638 |
|
| 639 |
<xsl:variable name="id"> |
| 640 |
<xsl:call-template name="object.id"/> |
| 641 |
</xsl:variable> |
| 642 |
|
| 643 |
<xsl:variable name="cid"> |
| 644 |
<xsl:call-template name="object.id"> |
| 645 |
<xsl:with-param name="object" select="$toc-context"/> |
| 646 |
</xsl:call-template> |
| 647 |
</xsl:variable> |
| 648 |
|
| 649 |
<xsl:call-template name="toc.line"> |
| 650 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 651 |
</xsl:call-template> |
| 652 |
|
| 653 |
<xsl:variable name="reldepth" |
| 654 |
select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 655 |
|
| 656 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 657 |
|
| 658 |
<xsl:if test="$toc.section.depth > 3 |
| 659 |
and $toc.max.depth > $depth.from.context |
| 660 |
and d:sect4"> |
| 661 |
<fo:block id="toc.{$cid}.{$id}"> |
| 662 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 663 |
<xsl:call-template name="set.toc.indent"> |
| 664 |
<xsl:with-param name="reldepth" select="$reldepth"/> |
| 665 |
</xsl:call-template> |
| 666 |
</xsl:attribute> |
| 667 |
|
| 668 |
<xsl:apply-templates select="d:sect4|d:qandaset[$qanda.in.toc != 0]" |
| 669 |
mode="toc"> |
| 670 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 671 |
</xsl:apply-templates> |
| 672 |
</fo:block> |
| 673 |
</xsl:if> |
| 674 |
</xsl:template> |
| 675 |
|
| 676 |
<xsl:template match="d:sect4" mode="toc"> |
| 677 |
<xsl:param name="toc-context" select="."/> |
| 678 |
|
| 679 |
<xsl:variable name="id"> |
| 680 |
<xsl:call-template name="object.id"/> |
| 681 |
</xsl:variable> |
| 682 |
|
| 683 |
<xsl:variable name="cid"> |
| 684 |
<xsl:call-template name="object.id"> |
| 685 |
<xsl:with-param name="object" select="$toc-context"/> |
| 686 |
</xsl:call-template> |
| 687 |
</xsl:variable> |
| 688 |
|
| 689 |
<xsl:call-template name="toc.line"> |
| 690 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 691 |
</xsl:call-template> |
| 692 |
|
| 693 |
<xsl:variable name="reldepth" |
| 694 |
select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 695 |
|
| 696 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 697 |
|
| 698 |
<xsl:if test="$toc.section.depth > 4 |
| 699 |
and $toc.max.depth > $depth.from.context |
| 700 |
and d:sect5"> |
| 701 |
<fo:block id="toc.{$cid}.{$id}"> |
| 702 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 703 |
<xsl:call-template name="set.toc.indent"> |
| 704 |
<xsl:with-param name="reldepth" select="$reldepth"/> |
| 705 |
</xsl:call-template> |
| 706 |
</xsl:attribute> |
| 707 |
|
| 708 |
<xsl:apply-templates select="d:sect5|d:qandaset[$qanda.in.toc != 0]" |
| 709 |
mode="toc"> |
| 710 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 711 |
</xsl:apply-templates> |
| 712 |
</fo:block> |
| 713 |
</xsl:if> |
| 714 |
</xsl:template> |
| 715 |
|
| 716 |
<xsl:template match="d:sect5|d:simplesect" mode="toc"> |
| 717 |
<xsl:param name="toc-context" select="."/> |
| 718 |
|
| 719 |
<xsl:call-template name="toc.line"> |
| 720 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 721 |
</xsl:call-template> |
| 722 |
</xsl:template> |
| 723 |
|
| 724 |
<xsl:template match="d:topic" mode="toc"> |
| 725 |
<xsl:param name="toc-context" select="."/> |
| 726 |
|
| 727 |
<xsl:call-template name="toc.line"> |
| 728 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 729 |
</xsl:call-template> |
| 730 |
</xsl:template> |
| 731 |
|
| 732 |
<xsl:template name="set.toc.indent"> |
| 733 |
<xsl:param name="reldepth"/> |
| 734 |
|
| 735 |
<xsl:variable name="depth"> |
| 736 |
<xsl:choose> |
| 737 |
<xsl:when test="$reldepth != ''"> |
| 738 |
<xsl:value-of select="$reldepth"/> |
| 739 |
</xsl:when> |
| 740 |
<xsl:otherwise> |
| 741 |
<xsl:value-of select="count(ancestor::*)"/> |
| 742 |
</xsl:otherwise> |
| 743 |
</xsl:choose> |
| 744 |
</xsl:variable> |
| 745 |
|
| 746 |
<xsl:choose> |
| 747 |
<xsl:when test="$fop.extensions != 0"> |
| 748 |
<xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/> |
| 749 |
</xsl:when> |
| 750 |
<xsl:otherwise> |
| 751 |
<xsl:value-of select="concat($toc.indent.width, 'pt')"/> |
| 752 |
</xsl:otherwise> |
| 753 |
</xsl:choose> |
| 754 |
</xsl:template> |
| 755 |
|
| 756 |
|
| 757 |
<xsl:template match="d:section" mode="toc"> |
| 758 |
<xsl:param name="toc-context" select="."/> |
| 759 |
|
| 760 |
<xsl:variable name="id"> |
| 761 |
<xsl:call-template name="object.id"/> |
| 762 |
</xsl:variable> |
| 763 |
|
| 764 |
<xsl:variable name="cid"> |
| 765 |
<xsl:call-template name="object.id"> |
| 766 |
<xsl:with-param name="object" select="$toc-context"/> |
| 767 |
</xsl:call-template> |
| 768 |
</xsl:variable> |
| 769 |
|
| 770 |
<xsl:variable name="depth" select="count(ancestor::d:section) + 1"/> |
| 771 |
<xsl:variable name="reldepth" |
| 772 |
select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 773 |
|
| 774 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 775 |
|
| 776 |
<xsl:if test="$toc.section.depth >= $depth"> |
| 777 |
<xsl:call-template name="toc.line"> |
| 778 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 779 |
</xsl:call-template> |
| 780 |
|
| 781 |
<xsl:if test="$toc.section.depth > $depth |
| 782 |
and $toc.max.depth > $depth.from.context |
| 783 |
and d:section"> |
| 784 |
<fo:block id="toc.{$cid}.{$id}"> |
| 785 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 786 |
<xsl:call-template name="set.toc.indent"> |
| 787 |
<xsl:with-param name="reldepth" select="$reldepth"/> |
| 788 |
</xsl:call-template> |
| 789 |
</xsl:attribute> |
| 790 |
|
| 791 |
<xsl:apply-templates select="d:section|d:qandaset[$qanda.in.toc != 0]" |
| 792 |
mode="toc"> |
| 793 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 794 |
</xsl:apply-templates> |
| 795 |
</fo:block> |
| 796 |
</xsl:if> |
| 797 |
</xsl:if> |
| 798 |
</xsl:template> |
| 799 |
|
| 800 |
<xsl:template match="d:bibliography|d:glossary" |
| 801 |
mode="toc"> |
| 802 |
<xsl:param name="toc-context" select="."/> |
| 803 |
|
| 804 |
<xsl:call-template name="toc.line"> |
| 805 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 806 |
</xsl:call-template> |
| 807 |
</xsl:template> |
| 808 |
|
| 809 |
<xsl:template match="d:index" mode="toc"> |
| 810 |
<xsl:param name="toc-context" select="."/> |
| 811 |
|
| 812 |
<xsl:if test="* or $generate.index != 0"> |
| 813 |
<xsl:call-template name="toc.line"> |
| 814 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 815 |
</xsl:call-template> |
| 816 |
</xsl:if> |
| 817 |
</xsl:template> |
| 818 |
|
| 819 |
<xsl:template match="d:title" mode="toc"> |
| 820 |
<xsl:apply-templates/> |
| 821 |
</xsl:template> |
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
<xsl:template name="list.of.titles"> |
| 826 |
<xsl:param name="titles" select="'table'"/> |
| 827 |
<xsl:param name="nodes" select=".//d:table"/> |
| 828 |
<xsl:param name="toc-context" select="."/> |
| 829 |
|
| 830 |
<xsl:variable name="id"> |
| 831 |
<xsl:call-template name="object.id"/> |
| 832 |
</xsl:variable> |
| 833 |
|
| 834 |
<xsl:if test="$nodes"> |
| 835 |
<fo:block id="lot...{$titles}...{$id}" |
| 836 |
xsl:use-attribute-sets="toc.margin.properties"> |
| 837 |
<xsl:choose> |
| 838 |
<xsl:when test="$titles='table'"> |
| 839 |
<xsl:call-template name="list.of.tables.titlepage"/> |
| 840 |
</xsl:when> |
| 841 |
<xsl:when test="$titles='figure'"> |
| 842 |
<xsl:call-template name="list.of.figures.titlepage"/> |
| 843 |
</xsl:when> |
| 844 |
<xsl:when test="$titles='equation'"> |
| 845 |
<xsl:call-template name="list.of.equations.titlepage"/> |
| 846 |
</xsl:when> |
| 847 |
<xsl:when test="$titles='example'"> |
| 848 |
<xsl:call-template name="list.of.examples.titlepage"/> |
| 849 |
</xsl:when> |
| 850 |
<xsl:when test="$titles='procedure'"> |
| 851 |
<xsl:call-template name="list.of.procedures.titlepage"/> |
| 852 |
</xsl:when> |
| 853 |
<xsl:otherwise> |
| 854 |
<xsl:call-template name="list.of.unknowns.titlepage"/> |
| 855 |
</xsl:otherwise> |
| 856 |
</xsl:choose> |
| 857 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 858 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 859 |
</xsl:apply-templates> |
| 860 |
</fo:block> |
| 861 |
</xsl:if> |
| 862 |
</xsl:template> |
| 863 |
|
| 864 |
<xsl:template name="component.list.of.titles"> |
| 865 |
<xsl:param name="titles" select="'table'"/> |
| 866 |
<xsl:param name="nodes" select=".//d:table"/> |
| 867 |
<xsl:param name="toc-context" select="."/> |
| 868 |
|
| 869 |
<xsl:variable name="id"> |
| 870 |
<xsl:call-template name="object.id"/> |
| 871 |
</xsl:variable> |
| 872 |
|
| 873 |
<xsl:if test="$nodes"> |
| 874 |
<fo:block id="lot...{$titles}...{$id}"> |
| 875 |
<xsl:choose> |
| 876 |
<xsl:when test="$titles='table'"> |
| 877 |
<xsl:call-template name="component.list.of.tables.titlepage"/> |
| 878 |
</xsl:when> |
| 879 |
<xsl:when test="$titles='figure'"> |
| 880 |
<xsl:call-template name="component.list.of.figures.titlepage"/> |
| 881 |
</xsl:when> |
| 882 |
<xsl:when test="$titles='equation'"> |
| 883 |
<xsl:call-template name="component.list.of.equations.titlepage"/> |
| 884 |
</xsl:when> |
| 885 |
<xsl:when test="$titles='example'"> |
| 886 |
<xsl:call-template name="component.list.of.examples.titlepage"/> |
| 887 |
</xsl:when> |
| 888 |
<xsl:when test="$titles='procedure'"> |
| 889 |
<xsl:call-template name="component.list.of.procedures.titlepage"/> |
| 890 |
</xsl:when> |
| 891 |
<xsl:otherwise> |
| 892 |
<xsl:call-template name="component.list.of.unknowns.titlepage"/> |
| 893 |
</xsl:otherwise> |
| 894 |
</xsl:choose> |
| 895 |
<xsl:apply-templates select="$nodes" mode="toc"> |
| 896 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 897 |
</xsl:apply-templates> |
| 898 |
</fo:block> |
| 899 |
</xsl:if> |
| 900 |
</xsl:template> |
| 901 |
|
| 902 |
<xsl:template match="d:figure|d:table|d:example|d:equation|d:procedure" mode="toc"> |
| 903 |
<xsl:param name="toc-context" select="."/> |
| 904 |
<xsl:call-template name="toc.line"> |
| 905 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 906 |
</xsl:call-template> |
| 907 |
</xsl:template> |
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
<xsl:template match="d:qandaset" mode="toc"> |
| 913 |
<xsl:param name="toc-context" select="."/> |
| 914 |
|
| 915 |
<xsl:variable name="id"> |
| 916 |
<xsl:call-template name="object.id"/> |
| 917 |
</xsl:variable> |
| 918 |
|
| 919 |
<xsl:variable name="cid"> |
| 920 |
<xsl:call-template name="object.id"> |
| 921 |
<xsl:with-param name="object" select="$toc-context"/> |
| 922 |
</xsl:call-template> |
| 923 |
</xsl:variable> |
| 924 |
|
| 925 |
<xsl:variable name="depth" select="count(ancestor::d:section) + 1"/> |
| 926 |
<xsl:variable name="reldepth" |
| 927 |
select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 928 |
|
| 929 |
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> |
| 930 |
|
| 931 |
<xsl:if test="$toc.section.depth >= $depth"> |
| 932 |
<xsl:call-template name="toc.line"> |
| 933 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 934 |
</xsl:call-template> |
| 935 |
|
| 936 |
<xsl:if test="$toc.section.depth > $depth |
| 937 |
and $toc.max.depth > $depth.from.context |
| 938 |
and (child::d:qandadiv or child::d:qandaentry)"> |
| 939 |
<fo:block id="toc.{$cid}.{$id}"> |
| 940 |
<xsl:attribute name="margin-{$direction.align.start}"> |
| 941 |
<xsl:call-template name="set.toc.indent"> |
| 942 |
<xsl:with-param name="reldepth" select="$reldepth"/> |
| 943 |
</xsl:call-template> |
| 944 |
</xsl:attribute> |
| 945 |
|
| 946 |
<xsl:apply-templates select="d:qandadiv|d:qandaentry" mode="toc"> |
| 947 |
<xsl:with-param name="toc-context" select="$toc-context"/> |
| 948 |
</xsl:apply-templates> |
| 949 |
</fo:block> |
| 950 |
</xsl:if> |
| 951 |
</xsl:if> |
| 952 |
</xsl:template> |
| 953 |
|
| 954 |
</xsl:stylesheet> |
| 955 |
|