chunk-code.xsl 24 KB

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