[c873d807] | 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" exclude-result-prefixes="exsl cf ng db" version="1.0">
|
---|
| 5 |
|
---|
| 6 | <!-- ********************************************************************
|
---|
[b1a51ac1] | 7 | $Id: chunk-code.xsl 9328 2012-05-03 16:28:23Z bobstayton $
|
---|
[c873d807] | 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 |
|
---|
| 19 | <xsl:template match="*" mode="chunk-filename">
|
---|
| 20 | <!-- returns the filename of a chunk -->
|
---|
| 21 | <xsl:variable name="ischunk">
|
---|
| 22 | <xsl:call-template name="chunk"/>
|
---|
| 23 | </xsl:variable>
|
---|
| 24 |
|
---|
| 25 | <xsl:variable name="fn">
|
---|
| 26 | <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
|
---|
| 27 | </xsl:variable>
|
---|
| 28 |
|
---|
| 29 | <!--
|
---|
| 30 | <xsl:message>
|
---|
| 31 | <xsl:value-of select="$ischunk"/>
|
---|
| 32 | <xsl:text> (</xsl:text>
|
---|
| 33 | <xsl:value-of select="local-name(.)"/>
|
---|
| 34 | <xsl:text>) </xsl:text>
|
---|
| 35 | <xsl:value-of select="$fn"/>
|
---|
| 36 | <xsl:text>, </xsl:text>
|
---|
| 37 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 38 | </xsl:message>
|
---|
| 39 | -->
|
---|
| 40 |
|
---|
| 41 | <!-- 2003-11-25 by ndw:
|
---|
| 42 | The following test used to read test="$ischunk != 0 and $fn != ''"
|
---|
| 43 | I've removed the ischunk part of the test so that href.to.uri and
|
---|
| 44 | href.from.uri will be fully qualified even if the source or target
|
---|
| 45 | isn't a chunk. I *think* that if $fn != '' then it's appropriate
|
---|
| 46 | to put the directory on the front, even if the element isn't a
|
---|
| 47 | chunk. I could be wrong. -->
|
---|
| 48 |
|
---|
| 49 | <xsl:if test="$fn != ''">
|
---|
| 50 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 51 | </xsl:if>
|
---|
| 52 |
|
---|
[b1a51ac1] | 53 | <xsl:value-of select="$chunked.filename.prefix"/>
|
---|
| 54 |
|
---|
[c873d807] | 55 | <xsl:value-of select="$fn"/>
|
---|
| 56 | <!-- You can't add the html.ext here because dbhtml filename= may already -->
|
---|
| 57 | <!-- have added it. It really does have to be handled in the recursive template -->
|
---|
| 58 | </xsl:template>
|
---|
| 59 |
|
---|
| 60 | <xsl:template match="*" mode="recursive-chunk-filename">
|
---|
| 61 | <xsl:param name="recursive" select="false()"/>
|
---|
| 62 |
|
---|
| 63 | <!-- returns the filename of a chunk -->
|
---|
| 64 | <xsl:variable name="ischunk">
|
---|
| 65 | <xsl:call-template name="chunk"/>
|
---|
| 66 | </xsl:variable>
|
---|
| 67 |
|
---|
| 68 | <xsl:variable name="dbhtml-filename">
|
---|
[60a5a938] | 69 | <xsl:call-template name="pi.dbhtml_filename"/>
|
---|
[c873d807] | 70 | </xsl:variable>
|
---|
| 71 |
|
---|
| 72 | <xsl:variable name="filename">
|
---|
| 73 | <xsl:choose>
|
---|
| 74 | <xsl:when test="$dbhtml-filename != ''">
|
---|
| 75 | <xsl:value-of select="$dbhtml-filename"/>
|
---|
| 76 | </xsl:when>
|
---|
| 77 | <!-- if this is the root element, use the root.filename -->
|
---|
| 78 | <xsl:when test="not(parent::*) and $root.filename != ''">
|
---|
| 79 | <xsl:value-of select="$root.filename"/>
|
---|
| 80 | <xsl:value-of select="$html.ext"/>
|
---|
| 81 | </xsl:when>
|
---|
| 82 | <!-- Special case -->
|
---|
| 83 | <xsl:when test="self::legalnotice and not($generate.legalnotice.link = 0)">
|
---|
| 84 | <xsl:choose>
|
---|
| 85 | <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)">
|
---|
| 86 | <!-- * if this legalnotice has an ID, then go ahead and use -->
|
---|
| 87 | <!-- * just the value of that ID as the basename for the file -->
|
---|
| 88 | <!-- * (that is, without prepending an "ln-" too it) -->
|
---|
| 89 | <xsl:value-of select="(@id|@xml:id)[1]"/>
|
---|
| 90 | <xsl:value-of select="$html.ext"/>
|
---|
| 91 | </xsl:when>
|
---|
| 92 | <xsl:otherwise>
|
---|
| 93 | <!-- * otherwise, if this legalnotice does not have an ID, -->
|
---|
| 94 | <!-- * then we generate an ID... -->
|
---|
| 95 | <xsl:variable name="id">
|
---|
| 96 | <xsl:call-template name="object.id"/>
|
---|
| 97 | </xsl:variable>
|
---|
| 98 | <!-- * ...and then we take that generated ID, prepend an -->
|
---|
| 99 | <!-- * "ln-" to it, and use that as the basename for the file -->
|
---|
| 100 | <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
|
---|
| 101 | </xsl:otherwise>
|
---|
| 102 | </xsl:choose>
|
---|
| 103 | </xsl:when>
|
---|
| 104 | <!-- if there's no dbhtml filename, and if we're to use IDs as -->
|
---|
| 105 | <!-- filenames, then use the ID to generate the filename. -->
|
---|
| 106 | <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0">
|
---|
| 107 | <xsl:value-of select="(@id|@xml:id)[1]"/>
|
---|
| 108 | <xsl:value-of select="$html.ext"/>
|
---|
| 109 | </xsl:when>
|
---|
| 110 | <xsl:otherwise/>
|
---|
| 111 | </xsl:choose>
|
---|
| 112 | </xsl:variable>
|
---|
| 113 |
|
---|
| 114 | <xsl:choose>
|
---|
| 115 | <xsl:when test="$ischunk='0'">
|
---|
| 116 | <!-- if called on something that isn't a chunk, walk up... -->
|
---|
| 117 | <xsl:choose>
|
---|
| 118 | <xsl:when test="count(parent::*)>0">
|
---|
| 119 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 120 | <xsl:with-param name="recursive" select="$recursive"/>
|
---|
| 121 | </xsl:apply-templates>
|
---|
| 122 | </xsl:when>
|
---|
| 123 | <!-- unless there is no up, in which case return "" -->
|
---|
| 124 | <xsl:otherwise/>
|
---|
| 125 | </xsl:choose>
|
---|
| 126 | </xsl:when>
|
---|
| 127 |
|
---|
| 128 | <xsl:when test="not($recursive) and $filename != ''">
|
---|
| 129 | <!-- if this chunk has an explicit name, use it -->
|
---|
| 130 | <xsl:value-of select="$filename"/>
|
---|
| 131 | </xsl:when>
|
---|
| 132 |
|
---|
| 133 | <xsl:when test="self::set">
|
---|
| 134 | <xsl:value-of select="$root.filename"/>
|
---|
| 135 | <xsl:if test="not($recursive)">
|
---|
| 136 | <xsl:value-of select="$html.ext"/>
|
---|
| 137 | </xsl:if>
|
---|
| 138 | </xsl:when>
|
---|
| 139 |
|
---|
| 140 | <xsl:when test="self::book">
|
---|
| 141 | <xsl:text>bk</xsl:text>
|
---|
| 142 | <xsl:number level="any" format="01"/>
|
---|
| 143 | <xsl:if test="not($recursive)">
|
---|
| 144 | <xsl:value-of select="$html.ext"/>
|
---|
| 145 | </xsl:if>
|
---|
| 146 | </xsl:when>
|
---|
| 147 |
|
---|
| 148 | <xsl:when test="self::article">
|
---|
| 149 | <xsl:if test="/set">
|
---|
| 150 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 151 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 152 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 153 | </xsl:apply-templates>
|
---|
| 154 | </xsl:if>
|
---|
| 155 |
|
---|
| 156 | <xsl:text>ar</xsl:text>
|
---|
| 157 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 158 | <xsl:if test="not($recursive)">
|
---|
| 159 | <xsl:value-of select="$html.ext"/>
|
---|
| 160 | </xsl:if>
|
---|
| 161 | </xsl:when>
|
---|
| 162 |
|
---|
| 163 | <xsl:when test="self::preface">
|
---|
| 164 | <xsl:if test="/set">
|
---|
| 165 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 166 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 167 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 168 | </xsl:apply-templates>
|
---|
| 169 | </xsl:if>
|
---|
| 170 |
|
---|
| 171 | <xsl:text>pr</xsl:text>
|
---|
| 172 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 173 | <xsl:if test="not($recursive)">
|
---|
| 174 | <xsl:value-of select="$html.ext"/>
|
---|
| 175 | </xsl:if>
|
---|
| 176 | </xsl:when>
|
---|
| 177 |
|
---|
| 178 | <xsl:when test="self::chapter">
|
---|
| 179 | <xsl:if test="/set">
|
---|
| 180 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 181 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 182 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 183 | </xsl:apply-templates>
|
---|
| 184 | </xsl:if>
|
---|
| 185 |
|
---|
| 186 | <xsl:text>ch</xsl:text>
|
---|
| 187 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 188 | <xsl:if test="not($recursive)">
|
---|
| 189 | <xsl:value-of select="$html.ext"/>
|
---|
| 190 | </xsl:if>
|
---|
| 191 | </xsl:when>
|
---|
| 192 |
|
---|
| 193 | <xsl:when test="self::appendix">
|
---|
| 194 | <xsl:if test="/set">
|
---|
| 195 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 196 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 197 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 198 | </xsl:apply-templates>
|
---|
| 199 | </xsl:if>
|
---|
| 200 |
|
---|
| 201 | <xsl:text>ap</xsl:text>
|
---|
| 202 | <xsl:number level="any" format="a" from="book"/>
|
---|
| 203 | <xsl:if test="not($recursive)">
|
---|
| 204 | <xsl:value-of select="$html.ext"/>
|
---|
| 205 | </xsl:if>
|
---|
| 206 | </xsl:when>
|
---|
| 207 |
|
---|
| 208 | <xsl:when test="self::part">
|
---|
| 209 | <xsl:choose>
|
---|
| 210 | <xsl:when test="/set">
|
---|
| 211 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 212 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 213 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 214 | </xsl:apply-templates>
|
---|
| 215 | </xsl:when>
|
---|
| 216 | <xsl:otherwise>
|
---|
| 217 | </xsl:otherwise>
|
---|
| 218 | </xsl:choose>
|
---|
| 219 |
|
---|
| 220 | <xsl:text>pt</xsl:text>
|
---|
| 221 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 222 | <xsl:if test="not($recursive)">
|
---|
| 223 | <xsl:value-of select="$html.ext"/>
|
---|
| 224 | </xsl:if>
|
---|
| 225 | </xsl:when>
|
---|
| 226 |
|
---|
| 227 | <xsl:when test="self::reference">
|
---|
| 228 | <xsl:choose>
|
---|
| 229 | <xsl:when test="/set">
|
---|
| 230 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 231 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 232 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 233 | </xsl:apply-templates>
|
---|
| 234 | </xsl:when>
|
---|
| 235 | <xsl:otherwise>
|
---|
| 236 | </xsl:otherwise>
|
---|
| 237 | </xsl:choose>
|
---|
| 238 |
|
---|
| 239 | <xsl:text>rn</xsl:text>
|
---|
| 240 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 241 | <xsl:if test="not($recursive)">
|
---|
| 242 | <xsl:value-of select="$html.ext"/>
|
---|
| 243 | </xsl:if>
|
---|
| 244 | </xsl:when>
|
---|
| 245 |
|
---|
| 246 | <xsl:when test="self::refentry">
|
---|
| 247 | <xsl:choose>
|
---|
| 248 | <xsl:when test="parent::reference">
|
---|
| 249 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 250 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 251 | </xsl:apply-templates>
|
---|
| 252 | </xsl:when>
|
---|
| 253 | <xsl:otherwise>
|
---|
[b1a51ac1] | 254 | <xsl:if test="/set">
|
---|
| 255 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 256 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 257 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 258 | </xsl:apply-templates>
|
---|
| 259 | </xsl:if>
|
---|
[c873d807] | 260 | </xsl:otherwise>
|
---|
| 261 | </xsl:choose>
|
---|
| 262 |
|
---|
| 263 | <xsl:text>re</xsl:text>
|
---|
| 264 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 265 | <xsl:if test="not($recursive)">
|
---|
| 266 | <xsl:value-of select="$html.ext"/>
|
---|
| 267 | </xsl:if>
|
---|
| 268 | </xsl:when>
|
---|
| 269 |
|
---|
| 270 | <xsl:when test="self::colophon">
|
---|
| 271 | <xsl:choose>
|
---|
| 272 | <xsl:when test="/set">
|
---|
| 273 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 274 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 275 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 276 | </xsl:apply-templates>
|
---|
| 277 | </xsl:when>
|
---|
| 278 | <xsl:otherwise>
|
---|
| 279 | </xsl:otherwise>
|
---|
| 280 | </xsl:choose>
|
---|
| 281 |
|
---|
| 282 | <xsl:text>co</xsl:text>
|
---|
| 283 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 284 | <xsl:if test="not($recursive)">
|
---|
| 285 | <xsl:value-of select="$html.ext"/>
|
---|
| 286 | </xsl:if>
|
---|
| 287 | </xsl:when>
|
---|
| 288 |
|
---|
| 289 | <xsl:when test="self::sect1 or self::sect2 or self::sect3 or self::sect4 or self::sect5 or self::section">
|
---|
| 290 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 291 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 292 | </xsl:apply-templates>
|
---|
| 293 | <xsl:text>s</xsl:text>
|
---|
| 294 | <xsl:number format="01"/>
|
---|
| 295 | <xsl:if test="not($recursive)">
|
---|
| 296 | <xsl:value-of select="$html.ext"/>
|
---|
| 297 | </xsl:if>
|
---|
| 298 | </xsl:when>
|
---|
| 299 |
|
---|
| 300 | <xsl:when test="self::bibliography">
|
---|
| 301 | <xsl:choose>
|
---|
| 302 | <xsl:when test="/set">
|
---|
| 303 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 304 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 305 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 306 | </xsl:apply-templates>
|
---|
| 307 | </xsl:when>
|
---|
| 308 | <xsl:otherwise>
|
---|
| 309 | </xsl:otherwise>
|
---|
| 310 | </xsl:choose>
|
---|
| 311 |
|
---|
| 312 | <xsl:text>bi</xsl:text>
|
---|
| 313 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 314 | <xsl:if test="not($recursive)">
|
---|
| 315 | <xsl:value-of select="$html.ext"/>
|
---|
| 316 | </xsl:if>
|
---|
| 317 | </xsl:when>
|
---|
| 318 |
|
---|
| 319 | <xsl:when test="self::glossary">
|
---|
| 320 | <xsl:choose>
|
---|
| 321 | <xsl:when test="/set">
|
---|
| 322 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 323 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 324 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 325 | </xsl:apply-templates>
|
---|
| 326 | </xsl:when>
|
---|
| 327 | <xsl:otherwise>
|
---|
| 328 | </xsl:otherwise>
|
---|
| 329 | </xsl:choose>
|
---|
| 330 |
|
---|
| 331 | <xsl:text>go</xsl:text>
|
---|
| 332 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 333 | <xsl:if test="not($recursive)">
|
---|
| 334 | <xsl:value-of select="$html.ext"/>
|
---|
| 335 | </xsl:if>
|
---|
| 336 | </xsl:when>
|
---|
| 337 |
|
---|
| 338 | <xsl:when test="self::index">
|
---|
| 339 | <xsl:choose>
|
---|
| 340 | <xsl:when test="/set">
|
---|
| 341 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 342 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 343 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 344 | </xsl:apply-templates>
|
---|
| 345 | </xsl:when>
|
---|
| 346 | <xsl:otherwise>
|
---|
| 347 | </xsl:otherwise>
|
---|
| 348 | </xsl:choose>
|
---|
| 349 |
|
---|
| 350 | <xsl:text>ix</xsl:text>
|
---|
| 351 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 352 | <xsl:if test="not($recursive)">
|
---|
| 353 | <xsl:value-of select="$html.ext"/>
|
---|
| 354 | </xsl:if>
|
---|
| 355 | </xsl:when>
|
---|
| 356 |
|
---|
| 357 | <xsl:when test="self::setindex">
|
---|
| 358 | <xsl:text>si</xsl:text>
|
---|
| 359 | <xsl:number level="any" format="01" from="set"/>
|
---|
| 360 | <xsl:if test="not($recursive)">
|
---|
| 361 | <xsl:value-of select="$html.ext"/>
|
---|
| 362 | </xsl:if>
|
---|
| 363 | </xsl:when>
|
---|
| 364 |
|
---|
[b1a51ac1] | 365 | <xsl:when test="self::topic">
|
---|
| 366 | <xsl:choose>
|
---|
| 367 | <xsl:when test="/set">
|
---|
| 368 | <!-- in a set, make sure we inherit the right book info... -->
|
---|
| 369 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
|
---|
| 370 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 371 | </xsl:apply-templates>
|
---|
| 372 | </xsl:when>
|
---|
| 373 | <xsl:otherwise>
|
---|
| 374 | </xsl:otherwise>
|
---|
| 375 | </xsl:choose>
|
---|
| 376 |
|
---|
| 377 | <xsl:text>to</xsl:text>
|
---|
| 378 | <xsl:number level="any" format="01" from="book"/>
|
---|
| 379 | <xsl:if test="not($recursive)">
|
---|
| 380 | <xsl:value-of select="$html.ext"/>
|
---|
| 381 | </xsl:if>
|
---|
| 382 | </xsl:when>
|
---|
| 383 |
|
---|
[c873d807] | 384 | <xsl:otherwise>
|
---|
| 385 | <xsl:text>chunk-filename-error-</xsl:text>
|
---|
| 386 | <xsl:value-of select="name(.)"/>
|
---|
| 387 | <xsl:number level="any" format="01" from="set"/>
|
---|
| 388 | <xsl:if test="not($recursive)">
|
---|
| 389 | <xsl:value-of select="$html.ext"/>
|
---|
| 390 | </xsl:if>
|
---|
| 391 | </xsl:otherwise>
|
---|
| 392 | </xsl:choose>
|
---|
| 393 | </xsl:template>
|
---|
| 394 |
|
---|
| 395 | <!-- ==================================================================== -->
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 |
|
---|
| 399 | <xsl:template match="processing-instruction('dbhtml')">
|
---|
| 400 | <!-- nop -->
|
---|
| 401 | </xsl:template>
|
---|
| 402 |
|
---|
| 403 | <!-- ==================================================================== -->
|
---|
| 404 |
|
---|
| 405 |
|
---|
| 406 | <xsl:template match="*" mode="find.chunks">
|
---|
| 407 | <xsl:variable name="chunk">
|
---|
| 408 | <xsl:call-template name="chunk"/>
|
---|
| 409 | </xsl:variable>
|
---|
| 410 |
|
---|
| 411 | <xsl:choose>
|
---|
| 412 | <xsl:when test="$chunk != 0">
|
---|
| 413 | <cf:div id="{generate-id()}">
|
---|
| 414 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
| 415 | <xsl:apply-templates select="*" mode="find.chunks"/>
|
---|
| 416 | </cf:div>
|
---|
| 417 | </xsl:when>
|
---|
| 418 | <xsl:otherwise>
|
---|
| 419 | <xsl:apply-templates select="*" mode="find.chunks"/>
|
---|
| 420 | </xsl:otherwise>
|
---|
| 421 | </xsl:choose>
|
---|
| 422 | </xsl:template>
|
---|
| 423 |
|
---|
[b1a51ac1] | 424 | <!-- Leave legalnotice chunk out of the list for Next and Prev -->
|
---|
| 425 | <xsl:template match="legalnotice" mode="find.chunks"/>
|
---|
| 426 |
|
---|
[c873d807] | 427 | <xsl:template match="/">
|
---|
| 428 | <!-- * Get a title for current doc so that we let the user -->
|
---|
| 429 | <!-- * know what document we are processing at this point. -->
|
---|
| 430 | <xsl:variable name="doc.title">
|
---|
| 431 | <xsl:call-template name="get.doc.title"/>
|
---|
| 432 | </xsl:variable>
|
---|
| 433 | <xsl:choose>
|
---|
| 434 | <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
|
---|
| 435 | toss the namespace and continue. Use the docbook5 namespaced
|
---|
| 436 | stylesheets for DocBook5 if you don't want to use this feature.-->
|
---|
[b1a51ac1] | 437 | <xsl:when test="$exsl.node.set.available != 0 and (*/self::ng:* or */self::db:*)">
|
---|
| 438 |
|
---|
[c873d807] | 439 | <xsl:call-template name="log.message">
|
---|
| 440 | <xsl:with-param name="level">Note</xsl:with-param>
|
---|
| 441 | <xsl:with-param name="source" select="$doc.title"/>
|
---|
| 442 | <xsl:with-param name="context-desc">
|
---|
| 443 | <xsl:text>namesp. cut</xsl:text>
|
---|
| 444 | </xsl:with-param>
|
---|
| 445 | <xsl:with-param name="message">
|
---|
| 446 | <xsl:text>processing stripped document</xsl:text>
|
---|
| 447 | </xsl:with-param>
|
---|
| 448 | </xsl:call-template>
|
---|
[b1a51ac1] | 449 |
|
---|
| 450 | <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
|
---|
[c873d807] | 451 | </xsl:when>
|
---|
| 452 | <!-- Can't process unless namespace removed -->
|
---|
| 453 | <xsl:when test="*/self::ng:* or */self::db:*">
|
---|
| 454 | <xsl:message terminate="yes">
|
---|
| 455 | <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
|
---|
| 456 | <xsl:text> cannot proceed.</xsl:text>
|
---|
| 457 | </xsl:message>
|
---|
| 458 | </xsl:when>
|
---|
| 459 | <xsl:otherwise>
|
---|
| 460 | <xsl:choose>
|
---|
| 461 | <xsl:when test="$rootid != ''">
|
---|
| 462 | <xsl:choose>
|
---|
| 463 | <xsl:when test="count(key('id',$rootid)) = 0">
|
---|
| 464 | <xsl:message terminate="yes">
|
---|
| 465 | <xsl:text>ID '</xsl:text>
|
---|
| 466 | <xsl:value-of select="$rootid"/>
|
---|
| 467 | <xsl:text>' not found in document.</xsl:text>
|
---|
| 468 | </xsl:message>
|
---|
| 469 | </xsl:when>
|
---|
| 470 | <xsl:otherwise>
|
---|
| 471 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
| 472 | <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
|
---|
| 473 | </xsl:if>
|
---|
| 474 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
| 475 | <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
|
---|
| 476 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
| 477 | <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
|
---|
| 478 | </xsl:if>
|
---|
| 479 | <xsl:if test="$generate.manifest != 0">
|
---|
| 480 | <xsl:call-template name="generate.manifest">
|
---|
| 481 | <xsl:with-param name="node" select="key('id',$rootid)"/>
|
---|
| 482 | </xsl:call-template>
|
---|
| 483 | </xsl:if>
|
---|
| 484 | </xsl:if>
|
---|
| 485 | </xsl:otherwise>
|
---|
| 486 | </xsl:choose>
|
---|
| 487 | </xsl:when>
|
---|
| 488 | <xsl:otherwise>
|
---|
| 489 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
| 490 | <xsl:apply-templates select="/" mode="collect.targets"/>
|
---|
| 491 | </xsl:if>
|
---|
| 492 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
| 493 | <xsl:apply-templates select="/" mode="process.root"/>
|
---|
| 494 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
| 495 | <xsl:apply-templates select="/" mode="collect.tex.math"/>
|
---|
| 496 | </xsl:if>
|
---|
| 497 | <xsl:if test="$generate.manifest != 0">
|
---|
| 498 | <xsl:call-template name="generate.manifest">
|
---|
| 499 | <xsl:with-param name="node" select="/"/>
|
---|
| 500 | </xsl:call-template>
|
---|
| 501 | </xsl:if>
|
---|
| 502 | </xsl:if>
|
---|
| 503 | </xsl:otherwise>
|
---|
| 504 | </xsl:choose>
|
---|
| 505 | </xsl:otherwise>
|
---|
| 506 | </xsl:choose>
|
---|
| 507 | </xsl:template>
|
---|
| 508 |
|
---|
| 509 | <xsl:template match="*" mode="process.root">
|
---|
| 510 | <xsl:apply-templates select="."/>
|
---|
[b1a51ac1] | 511 | <xsl:call-template name="generate.css.files"/>
|
---|
[c873d807] | 512 | </xsl:template>
|
---|
| 513 |
|
---|
| 514 | <!-- ====================================================================== -->
|
---|
| 515 |
|
---|
[b1a51ac1] | 516 | <xsl:template match="set|book|part|preface|chapter|appendix |article |topic |reference|refentry |book/glossary|article/glossary|part/glossary |book/bibliography|article/bibliography|part/bibliography |colophon">
|
---|
[c873d807] | 517 | <xsl:choose>
|
---|
| 518 | <xsl:when test="$onechunk != 0 and parent::*">
|
---|
| 519 | <xsl:apply-imports/>
|
---|
| 520 | </xsl:when>
|
---|
| 521 | <xsl:otherwise>
|
---|
| 522 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 523 | </xsl:otherwise>
|
---|
| 524 | </xsl:choose>
|
---|
| 525 | </xsl:template>
|
---|
| 526 |
|
---|
| 527 | <xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
|
---|
| 528 | <xsl:variable name="ischunk">
|
---|
| 529 | <xsl:call-template name="chunk"/>
|
---|
| 530 | </xsl:variable>
|
---|
| 531 |
|
---|
| 532 | <xsl:choose>
|
---|
| 533 | <xsl:when test="not(parent::*)">
|
---|
| 534 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 535 | </xsl:when>
|
---|
| 536 | <xsl:when test="$ischunk = 0">
|
---|
| 537 | <xsl:apply-imports/>
|
---|
| 538 | </xsl:when>
|
---|
| 539 | <xsl:otherwise>
|
---|
| 540 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 541 | </xsl:otherwise>
|
---|
| 542 | </xsl:choose>
|
---|
| 543 | </xsl:template>
|
---|
| 544 |
|
---|
| 545 | <xsl:template match="setindex |book/index |article/index |part/index">
|
---|
| 546 | <!-- some implementations use completely empty index tags to indicate -->
|
---|
| 547 | <!-- where an automatically generated index should be inserted. so -->
|
---|
| 548 | <!-- if the index is completely empty, skip it. -->
|
---|
| 549 | <xsl:if test="count(*)>0 or $generate.index != '0'">
|
---|
| 550 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 551 | </xsl:if>
|
---|
| 552 | </xsl:template>
|
---|
| 553 |
|
---|
| 554 | <!-- Resolve xml:base attributes -->
|
---|
| 555 | <xsl:template match="@fileref">
|
---|
| 556 | <!-- need a check for absolute urls -->
|
---|
| 557 | <xsl:choose>
|
---|
| 558 | <xsl:when test="contains(., ':')">
|
---|
| 559 | <!-- it has a uri scheme so it is an absolute uri -->
|
---|
| 560 | <xsl:value-of select="."/>
|
---|
| 561 | </xsl:when>
|
---|
| 562 | <xsl:when test="$keep.relative.image.uris != 0">
|
---|
| 563 | <!-- leave it alone -->
|
---|
| 564 | <xsl:value-of select="."/>
|
---|
| 565 | </xsl:when>
|
---|
| 566 | <xsl:otherwise>
|
---|
| 567 | <!-- its a relative uri -->
|
---|
| 568 | <xsl:call-template name="relative-uri">
|
---|
| 569 | <xsl:with-param name="destdir">
|
---|
| 570 | <xsl:call-template name="dbhtml-dir">
|
---|
| 571 | <xsl:with-param name="context" select=".."/>
|
---|
| 572 | </xsl:call-template>
|
---|
| 573 | </xsl:with-param>
|
---|
| 574 | </xsl:call-template>
|
---|
| 575 | </xsl:otherwise>
|
---|
| 576 | </xsl:choose>
|
---|
| 577 | </xsl:template>
|
---|
| 578 |
|
---|
| 579 | <!-- ==================================================================== -->
|
---|
[b1a51ac1] | 580 | <xsl:template match="set|book|part|preface|chapter|appendix |article |topic |reference|refentry |sect1|sect2|sect3|sect4|sect5 |section |book/glossary|article/glossary|part/glossary |book/bibliography|article/bibliography|part/bibliography |colophon" mode="enumerate-files">
|
---|
[c873d807] | 581 | <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
|
---|
| 582 | <xsl:if test="$ischunk='1'">
|
---|
| 583 | <xsl:call-template name="make-relative-filename">
|
---|
| 584 | <xsl:with-param name="base.dir">
|
---|
| 585 | <xsl:if test="$manifest.in.base.dir = 0">
|
---|
[b1a51ac1] | 586 | <xsl:value-of select="$chunk.base.dir"/>
|
---|
[c873d807] | 587 | </xsl:if>
|
---|
| 588 | </xsl:with-param>
|
---|
| 589 | <xsl:with-param name="base.name">
|
---|
| 590 | <xsl:apply-templates mode="chunk-filename" select="."/>
|
---|
| 591 | </xsl:with-param>
|
---|
| 592 | </xsl:call-template>
|
---|
| 593 | <xsl:text>
|
---|
| 594 | </xsl:text>
|
---|
| 595 | </xsl:if>
|
---|
| 596 | <xsl:apply-templates select="*" mode="enumerate-files"/>
|
---|
| 597 | </xsl:template>
|
---|
| 598 |
|
---|
| 599 | <xsl:template match="book/index|article/index|part/index" mode="enumerate-files">
|
---|
| 600 | <xsl:if test="$htmlhelp.output != 1">
|
---|
| 601 | <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
|
---|
| 602 | <xsl:if test="$ischunk='1'">
|
---|
| 603 | <xsl:call-template name="make-relative-filename">
|
---|
| 604 | <xsl:with-param name="base.dir">
|
---|
| 605 | <xsl:if test="$manifest.in.base.dir = 0">
|
---|
[b1a51ac1] | 606 | <xsl:value-of select="$chunk.base.dir"/>
|
---|
[c873d807] | 607 | </xsl:if>
|
---|
| 608 | </xsl:with-param>
|
---|
| 609 | <xsl:with-param name="base.name">
|
---|
| 610 | <xsl:apply-templates mode="chunk-filename" select="."/>
|
---|
| 611 | </xsl:with-param>
|
---|
| 612 | </xsl:call-template>
|
---|
| 613 | <xsl:text>
|
---|
| 614 | </xsl:text>
|
---|
| 615 | </xsl:if>
|
---|
| 616 | <xsl:apply-templates select="*" mode="enumerate-files"/>
|
---|
| 617 | </xsl:if>
|
---|
| 618 | </xsl:template>
|
---|
| 619 |
|
---|
| 620 | <xsl:template match="legalnotice" mode="enumerate-files">
|
---|
| 621 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
---|
| 622 | <xsl:if test="$generate.legalnotice.link != 0">
|
---|
| 623 | <xsl:call-template name="make-relative-filename">
|
---|
| 624 | <xsl:with-param name="base.dir">
|
---|
| 625 | <xsl:if test="$manifest.in.base.dir = 0">
|
---|
[b1a51ac1] | 626 | <xsl:value-of select="$chunk.base.dir"/>
|
---|
[c873d807] | 627 | </xsl:if>
|
---|
| 628 | </xsl:with-param>
|
---|
| 629 | <xsl:with-param name="base.name">
|
---|
| 630 | <xsl:apply-templates mode="chunk-filename" select="."/>
|
---|
| 631 | </xsl:with-param>
|
---|
| 632 | </xsl:call-template>
|
---|
| 633 | <xsl:text>
|
---|
| 634 | </xsl:text>
|
---|
| 635 | </xsl:if>
|
---|
| 636 | </xsl:template>
|
---|
| 637 |
|
---|
| 638 | <xsl:template match="mediaobject[imageobject] | inlinemediaobject[imageobject]" mode="enumerate-files">
|
---|
| 639 | <xsl:variable name="longdesc.uri">
|
---|
| 640 | <xsl:call-template name="longdesc.uri">
|
---|
| 641 | <xsl:with-param name="mediaobject" select="."/>
|
---|
| 642 | </xsl:call-template>
|
---|
| 643 | </xsl:variable>
|
---|
| 644 | <xsl:variable name="mediaobject" select="."/>
|
---|
| 645 |
|
---|
| 646 | <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
|
---|
| 647 | <xsl:call-template name="longdesc.uri">
|
---|
| 648 | <xsl:with-param name="mediaobject" select="$mediaobject"/>
|
---|
| 649 | </xsl:call-template>
|
---|
| 650 | <xsl:text>
|
---|
| 651 | </xsl:text>
|
---|
| 652 | </xsl:if>
|
---|
| 653 | </xsl:template>
|
---|
| 654 |
|
---|
| 655 | <xsl:template match="text()" mode="enumerate-files">
|
---|
| 656 | </xsl:template>
|
---|
| 657 |
|
---|
| 658 | </xsl:stylesheet>
|
---|