profile-chunk-code.xsl 22 KB

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