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