chunk-code.xsl 23 KB

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