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