htmlhelp-common.xsl 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. <?xml version="1.0"?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY lf '<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#xA;</xsl:text>'>
  4. ]>
  5. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  6. xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  7. xmlns:exsl="http://exslt.org/common"
  8. xmlns:set="http://exslt.org/sets"
  9. xmlns:h="urn:x-hex"
  10. xmlns:ng="http://docbook.org/docbook-ng"
  11. xmlns:db="http://docbook.org/ns/docbook"
  12. version="1.0"
  13. exclude-result-prefixes="doc exsl set h db ng">
  14. <!-- ********************************************************************
  15. $Id: htmlhelp-common.xsl 9151 2011-11-12 00:16:19Z bobstayton $
  16. ******************************************************************** -->
  17. <!-- ==================================================================== -->
  18. <!-- Customizations of standard HTML stylesheet parameters -->
  19. <!-- no navigation on pages by default, HTML Help provides its own navigation controls -->
  20. <xsl:param name="suppress.navigation" select="1"/>
  21. <!-- no separate HTML page with index, index is built inside CHM index pane -->
  22. <xsl:param name="generate.index" select="0"/>
  23. <!-- ==================================================================== -->
  24. <xsl:param name="htmlhelp.generate.index" select="//indexterm[1]|//db:indexterm[1]|//ng:indexterm[1]"/>
  25. <!-- Set up HTML Help flag -->
  26. <xsl:variable name="htmlhelp.output" select="1"/>
  27. <!-- ==================================================================== -->
  28. <xsl:template match="/">
  29. <!-- * Get a title for current doc so that we let the user -->
  30. <!-- * know what document we are processing at this point. -->
  31. <xsl:variable name="doc.title">
  32. <xsl:call-template name="get.doc.title"/>
  33. </xsl:variable>
  34. <xsl:choose>
  35. <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
  36. toss the namespace and continue. Use the docbook5 namespaced
  37. stylesheets for DocBook5 if you don't want to use this feature.-->
  38. <xsl:when test="$exsl.node.set.available != 0
  39. and (*/self::ng:* or */self::db:*)">
  40. <xsl:call-template name="log.message">
  41. <xsl:with-param name="level">Note</xsl:with-param>
  42. <xsl:with-param name="source" select="$doc.title"/>
  43. <xsl:with-param name="context-desc">
  44. <xsl:text>namesp. cut</xsl:text>
  45. </xsl:with-param>
  46. <xsl:with-param name="message">
  47. <xsl:text>stripped namespace before processing</xsl:text>
  48. </xsl:with-param>
  49. </xsl:call-template>
  50. <xsl:variable name="nons">
  51. <xsl:apply-templates mode="stripNS"/>
  52. </xsl:variable>
  53. <xsl:call-template name="log.message">
  54. <xsl:with-param name="level">Note</xsl:with-param>
  55. <xsl:with-param name="source" select="$doc.title"/>
  56. <xsl:with-param name="context-desc">
  57. <xsl:text>namesp. cut</xsl:text>
  58. </xsl:with-param>
  59. <xsl:with-param name="message">
  60. <xsl:text>processing stripped document</xsl:text>
  61. </xsl:with-param>
  62. </xsl:call-template>
  63. <xsl:apply-templates select="exsl:node-set($nons)"/>
  64. </xsl:when>
  65. <xsl:otherwise>
  66. <xsl:if test="$htmlhelp.only != 1">
  67. <xsl:choose>
  68. <xsl:when test="$rootid != ''">
  69. <xsl:choose>
  70. <xsl:when test="count(key('id',$rootid)) = 0">
  71. <xsl:message terminate="yes">
  72. <xsl:text>ID '</xsl:text>
  73. <xsl:value-of select="$rootid"/>
  74. <xsl:text>' not found in document.</xsl:text>
  75. </xsl:message>
  76. </xsl:when>
  77. <xsl:otherwise>
  78. <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
  79. <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </xsl:when>
  83. <xsl:otherwise>
  84. <xsl:if test="$collect.xref.targets = 'yes' or
  85. $collect.xref.targets = 'only'">
  86. <xsl:apply-templates select="/" mode="collect.targets"/>
  87. </xsl:if>
  88. <xsl:if test="$collect.xref.targets != 'only'">
  89. <xsl:apply-templates select="/" mode="process.root"/>
  90. </xsl:if>
  91. </xsl:otherwise>
  92. </xsl:choose>
  93. </xsl:if>
  94. <xsl:if test="$collect.xref.targets != 'only'">
  95. <xsl:call-template name="hhp"/>
  96. <xsl:call-template name="hhc"/>
  97. <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
  98. ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
  99. <xsl:call-template name="hh-map"/>
  100. <xsl:call-template name="hh-alias"/>
  101. </xsl:if>
  102. <xsl:if test="$htmlhelp.generate.index">
  103. <xsl:call-template name="hhk"/>
  104. </xsl:if>
  105. </xsl:if>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </xsl:template>
  109. <!-- ==================================================================== -->
  110. <xsl:template name="hhp">
  111. <xsl:call-template name="write.text.chunk">
  112. <xsl:with-param name="filename">
  113. <xsl:if test="$manifest.in.base.dir != 0">
  114. <xsl:value-of select="$chunk.base.dir"/>
  115. </xsl:if>
  116. <xsl:value-of select="$htmlhelp.hhp"/>
  117. </xsl:with-param>
  118. <xsl:with-param name="method" select="'text'"/>
  119. <xsl:with-param name="content">
  120. <xsl:call-template name="hhp-main"/>
  121. </xsl:with-param>
  122. <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  123. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  124. </xsl:call-template>
  125. </xsl:template>
  126. <!-- ==================================================================== -->
  127. <xsl:template name="hhp-main">
  128. <xsl:variable name="raw.help.title">
  129. <xsl:choose>
  130. <xsl:when test="$htmlhelp.title = ''">
  131. <xsl:choose>
  132. <xsl:when test="$rootid != ''">
  133. <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
  134. </xsl:when>
  135. <xsl:otherwise>
  136. <xsl:apply-templates select="/*" mode="title.markup"/>
  137. </xsl:otherwise>
  138. </xsl:choose>
  139. </xsl:when>
  140. <xsl:otherwise>
  141. <xsl:value-of select="$htmlhelp.title"/>
  142. </xsl:otherwise>
  143. </xsl:choose>
  144. </xsl:variable>
  145. <xsl:variable name="help.title" select="normalize-space($raw.help.title)"/>
  146. <xsl:variable name="default.topic">
  147. <xsl:choose>
  148. <xsl:when test="$htmlhelp.default.topic != ''">
  149. <xsl:value-of select="$htmlhelp.default.topic"/>
  150. </xsl:when>
  151. <xsl:otherwise>
  152. <xsl:call-template name="make-relative-filename">
  153. <xsl:with-param name="base.dir">
  154. <xsl:if test="$manifest.in.base.dir = 0">
  155. <xsl:value-of select="$chunk.base.dir"/>
  156. </xsl:if>
  157. </xsl:with-param>
  158. <xsl:with-param name="base.name">
  159. <xsl:choose>
  160. <xsl:when test="$rootid != ''">
  161. <xsl:apply-templates select="key('id',$rootid)" mode="chunk-filename"/>
  162. </xsl:when>
  163. <xsl:otherwise>
  164. <xsl:apply-templates select="/" mode="chunk-filename"/>
  165. </xsl:otherwise>
  166. </xsl:choose>
  167. </xsl:with-param>
  168. </xsl:call-template>
  169. </xsl:otherwise>
  170. </xsl:choose>
  171. </xsl:variable>
  172. <xsl:variable name="xnavigation">
  173. <xsl:text>0x</xsl:text>
  174. <xsl:call-template name="toHex">
  175. <xsl:with-param name="n" select="9504 + $htmlhelp.show.menu * 65536
  176. + $htmlhelp.show.advanced.search * 131072
  177. + $htmlhelp.show.favorities * 4096
  178. + (1 - $htmlhelp.show.toolbar.text) * 64
  179. + $htmlhelp.remember.window.position * 262144"/>
  180. </xsl:call-template>
  181. </xsl:variable>
  182. <xsl:variable name="xbuttons">
  183. <xsl:text>0x</xsl:text>
  184. <xsl:call-template name="toHex">
  185. <xsl:with-param name="n" select="0 + $htmlhelp.button.hideshow * 2
  186. + $htmlhelp.button.back * 4
  187. + $htmlhelp.button.forward * 8
  188. + $htmlhelp.button.stop * 16
  189. + $htmlhelp.button.refresh * 32
  190. + $htmlhelp.button.home * 64
  191. + $htmlhelp.button.options * 4096
  192. + $htmlhelp.button.print * 8192
  193. + $htmlhelp.button.locate * 2048
  194. + $htmlhelp.button.jump1 * 262144
  195. + $htmlhelp.button.jump2 * 524288
  196. + $htmlhelp.button.next * 2097152
  197. + $htmlhelp.button.prev * 4194304
  198. + $htmlhelp.button.zoom * 1048576"/>
  199. </xsl:call-template>
  200. </xsl:variable>
  201. <xsl:text>[OPTIONS]
  202. </xsl:text>
  203. <xsl:if test="$htmlhelp.generate.index">
  204. <xsl:text>Auto Index=Yes
  205. </xsl:text></xsl:if>
  206. <xsl:if test="$htmlhelp.hhc.binary != 0">
  207. <xsl:text>Binary TOC=Yes
  208. </xsl:text></xsl:if>
  209. <xsl:text>Compatibility=1.1 or later
  210. Compiled file=</xsl:text><xsl:value-of select="$htmlhelp.chm"/><xsl:text>
  211. Contents file=</xsl:text><xsl:value-of select="$htmlhelp.hhc"/><xsl:text>
  212. </xsl:text>
  213. <xsl:if test="$htmlhelp.hhp.window != ''">
  214. <xsl:text>Default Window=</xsl:text><xsl:value-of select="$htmlhelp.hhp.window"/><xsl:text>
  215. </xsl:text></xsl:if>
  216. <xsl:text>Default topic=</xsl:text><xsl:value-of select="$default.topic"/>
  217. <xsl:text>
  218. Display compile progress=</xsl:text>
  219. <xsl:choose>
  220. <xsl:when test="$htmlhelp.display.progress != 1">
  221. <xsl:text>No</xsl:text>
  222. </xsl:when>
  223. <xsl:otherwise>
  224. <xsl:text>Yes</xsl:text>
  225. </xsl:otherwise>
  226. </xsl:choose>
  227. <xsl:text>
  228. Full-text search=Yes
  229. </xsl:text>
  230. <xsl:if test="$htmlhelp.generate.index">
  231. <xsl:text>Index file=</xsl:text><xsl:value-of select="$htmlhelp.hhk"/><xsl:text>
  232. </xsl:text></xsl:if>
  233. <xsl:text>Language=</xsl:text>
  234. <xsl:for-each select="*"> <!-- Change context from / to root element -->
  235. <xsl:call-template name="gentext.template">
  236. <xsl:with-param name="context" select="'htmlhelp'"/>
  237. <xsl:with-param name="name" select="'langcode'"/>
  238. </xsl:call-template>
  239. </xsl:for-each>
  240. <xsl:text>
  241. Title=</xsl:text>
  242. <xsl:value-of select="$help.title"/>
  243. <xsl:text>
  244. Enhanced decompilation=</xsl:text>
  245. <xsl:choose>
  246. <xsl:when test="$htmlhelp.enhanced.decompilation != 0">
  247. <xsl:text>Yes</xsl:text>
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <xsl:text>No</xsl:text>
  251. </xsl:otherwise>
  252. </xsl:choose>
  253. <xsl:if test="$htmlhelp.hhp.window != ''">
  254. <xsl:text>
  255. [WINDOWS]
  256. </xsl:text>
  257. <xsl:value-of select="$htmlhelp.hhp.window"/>
  258. <xsl:text>="</xsl:text>
  259. <xsl:value-of select="$help.title"/>
  260. <xsl:text>","</xsl:text><xsl:value-of select="$htmlhelp.hhc"/>
  261. <xsl:text>",</xsl:text>
  262. <xsl:if test="$htmlhelp.generate.index">
  263. <xsl:text>"</xsl:text>
  264. <xsl:value-of select="$htmlhelp.hhk"/>
  265. <xsl:text>"</xsl:text>
  266. </xsl:if>
  267. <xsl:text>,"</xsl:text>
  268. <xsl:value-of select="$default.topic"/>
  269. <xsl:text>",</xsl:text>
  270. <xsl:text>"</xsl:text>
  271. <xsl:choose>
  272. <xsl:when test="$htmlhelp.button.home != 0">
  273. <xsl:value-of select="$htmlhelp.button.home.url"/>
  274. </xsl:when>
  275. <xsl:otherwise>
  276. <xsl:value-of select="$default.topic"/>
  277. </xsl:otherwise>
  278. </xsl:choose>
  279. <xsl:text>"</xsl:text>
  280. <xsl:text>,</xsl:text>
  281. <xsl:if test="$htmlhelp.button.jump1 != 0">
  282. <xsl:text>"</xsl:text>
  283. <xsl:value-of select="$htmlhelp.button.jump1.url"/>
  284. <xsl:text>"</xsl:text>
  285. </xsl:if>
  286. <xsl:text>,</xsl:text>
  287. <xsl:if test="$htmlhelp.button.jump1 != 0">
  288. <xsl:text>"</xsl:text>
  289. <xsl:value-of select="$htmlhelp.button.jump1.title"/>
  290. <xsl:text>"</xsl:text>
  291. </xsl:if>
  292. <xsl:text>,</xsl:text>
  293. <xsl:if test="$htmlhelp.button.jump2 != 0">
  294. <xsl:text>"</xsl:text>
  295. <xsl:value-of select="$htmlhelp.button.jump2.url"/>
  296. <xsl:text>"</xsl:text>
  297. </xsl:if>
  298. <xsl:text>,</xsl:text>
  299. <xsl:if test="$htmlhelp.button.jump2 != 0">
  300. <xsl:text>"</xsl:text>
  301. <xsl:value-of select="$htmlhelp.button.jump2.title"/>
  302. <xsl:text>"</xsl:text>
  303. </xsl:if>
  304. <xsl:text>,</xsl:text>
  305. <xsl:value-of select="$xnavigation"/>
  306. <xsl:text>,</xsl:text><xsl:value-of select="$htmlhelp.hhc.width"/><xsl:text>,</xsl:text>
  307. <xsl:value-of select="$xbuttons"/>
  308. <xsl:text>,</xsl:text><xsl:value-of select="$htmlhelp.window.geometry"/><xsl:text>,,,,,,,0
  309. </xsl:text>
  310. </xsl:if>
  311. <!--
  312. Needs more investigation to generate propetly all fields
  313. <xsl:text>search="</xsl:text>
  314. <xsl:value-of select="normalize-space(//title[1])"/>
  315. <xsl:text>","toc.hhc","index.hhk","</xsl:text>
  316. <xsl:value-of select="$root.filename"/>
  317. <xsl:text>.html","</xsl:text>
  318. <xsl:value-of select="$root.filename"/>
  319. <xsl:text>.html",,,,,</xsl:text>
  320. <xsl:value-of select="$xnavigation"/>
  321. <xsl:text>,</xsl:text>
  322. <xsl:value-of select="$htmlhelp.hhc.width"/>
  323. <xsl:text>,</xsl:text>
  324. <xsl:value-of select="$xbuttons"/>
  325. <xsl:text>,</xsl:text>
  326. <xsl:value-of select="$htmlhelp.window.geometry"/>
  327. <xsl:text>,,,,,2,,0
  328. </xsl:text>
  329. -->
  330. <xsl:if test="$htmlhelp.hhp.windows">
  331. <xsl:value-of select="$htmlhelp.hhp.windows"/>
  332. </xsl:if>
  333. <xsl:text>
  334. [FILES]
  335. </xsl:text>
  336. <xsl:choose>
  337. <xsl:when test="$rootid != ''">
  338. <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-files"/>
  339. </xsl:when>
  340. <xsl:otherwise>
  341. <xsl:apply-templates select="/" mode="enumerate-files"/>
  342. </xsl:otherwise>
  343. </xsl:choose>
  344. <xsl:if test="$htmlhelp.enumerate.images">
  345. <xsl:variable name="imagelist">
  346. <xsl:choose>
  347. <xsl:when test="$rootid != ''">
  348. <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-images"/>
  349. </xsl:when>
  350. <xsl:otherwise>
  351. <xsl:apply-templates select="/" mode="enumerate-images"/>
  352. </xsl:otherwise>
  353. </xsl:choose>
  354. </xsl:variable>
  355. <xsl:choose>
  356. <xsl:when test="$exsl.node.set.available != 0
  357. and function-available('set:distinct')">
  358. <xsl:for-each select="set:distinct(exsl:node-set($imagelist)/filename)">
  359. <xsl:value-of select="."/>
  360. <xsl:text>&#10;</xsl:text>
  361. </xsl:for-each>
  362. </xsl:when>
  363. <xsl:otherwise>
  364. <xsl:value-of select="$imagelist"/>
  365. </xsl:otherwise>
  366. </xsl:choose>
  367. </xsl:if>
  368. <xsl:if test="($htmlhelp.force.map.and.alias != 0) or
  369. ($rootid = '' and //processing-instruction('dbhh')) or
  370. ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
  371. <xsl:text>
  372. [ALIAS]
  373. #include </xsl:text><xsl:value-of select="$htmlhelp.alias.file"/><xsl:text>
  374. [MAP]
  375. #include </xsl:text><xsl:value-of select="$htmlhelp.map.file"/><xsl:text>
  376. </xsl:text>
  377. </xsl:if>
  378. <xsl:value-of select="$htmlhelp.hhp.tail"/>
  379. </xsl:template>
  380. <!-- ==================================================================== -->
  381. <xsl:template match="graphic|inlinegraphic[@format!='linespecific']" mode="enumerate-images">
  382. <xsl:call-template name="write.filename.enumerate-images">
  383. <xsl:with-param name="filename">
  384. <xsl:call-template name="mediaobject.filename.enumerate-images">
  385. <xsl:with-param name="object" select="."/>
  386. </xsl:call-template>
  387. </xsl:with-param>
  388. </xsl:call-template>
  389. </xsl:template>
  390. <xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
  391. <xsl:call-template name="select.mediaobject.enumerate-images"/>
  392. </xsl:template>
  393. <xsl:template name="select.mediaobject.enumerate-images">
  394. <xsl:param name="olist"
  395. select="imageobject|imageobjectco
  396. |videoobject|audioobject|textobject"/>
  397. <xsl:param name="count">1</xsl:param>
  398. <xsl:if test="$count &lt;= count($olist)">
  399. <xsl:variable name="object" select="$olist[position()=$count]"/>
  400. <xsl:variable name="useobject">
  401. <xsl:choose>
  402. <!-- The phrase is never used -->
  403. <xsl:when test="name($object)='textobject' and $object/phrase">
  404. <xsl:text>0</xsl:text>
  405. </xsl:when>
  406. <!-- The first textobject is a reasonable fallback (but not for image in HH) -->
  407. <xsl:when test="name($object)='textobject'">
  408. <xsl:text>0</xsl:text>
  409. </xsl:when>
  410. <!-- If there's only one object, use it -->
  411. <xsl:when test="$count = 1 and count($olist) = 1">
  412. <xsl:text>1</xsl:text>
  413. </xsl:when>
  414. <!-- Otherwise, see if this one is a useable graphic -->
  415. <xsl:otherwise>
  416. <xsl:choose>
  417. <!-- peek inside imageobjectco to simplify the test -->
  418. <xsl:when test="local-name($object) = 'imageobjectco'">
  419. <xsl:call-template name="is.acceptable.mediaobject">
  420. <xsl:with-param name="object" select="$object/imageobject"/>
  421. </xsl:call-template>
  422. </xsl:when>
  423. <xsl:otherwise>
  424. <xsl:call-template name="is.acceptable.mediaobject">
  425. <xsl:with-param name="object" select="$object"/>
  426. </xsl:call-template>
  427. </xsl:otherwise>
  428. </xsl:choose>
  429. </xsl:otherwise>
  430. </xsl:choose>
  431. </xsl:variable>
  432. <xsl:choose>
  433. <xsl:when test="$useobject='1' and $object[not(*/@format='linespecific')]">
  434. <xsl:call-template name="write.filename.enumerate-images">
  435. <xsl:with-param name="filename">
  436. <xsl:call-template name="mediaobject.filename.enumerate-images">
  437. <xsl:with-param name="object" select="$object"/>
  438. </xsl:call-template>
  439. </xsl:with-param>
  440. </xsl:call-template>
  441. </xsl:when>
  442. <xsl:otherwise>
  443. <xsl:call-template name="select.mediaobject.enumerate-images">
  444. <xsl:with-param name="olist" select="$olist"/>
  445. <xsl:with-param name="count" select="$count + 1"/>
  446. </xsl:call-template>
  447. </xsl:otherwise>
  448. </xsl:choose>
  449. </xsl:if>
  450. </xsl:template>
  451. <xsl:template name="mediaobject.filename.enumerate-images">
  452. <xsl:param name="object"/>
  453. <xsl:variable name="urifilename">
  454. <xsl:call-template name="mediaobject.filename">
  455. <xsl:with-param name="object" select="$object"/>
  456. </xsl:call-template>
  457. </xsl:variable>
  458. <xsl:variable name="filename">
  459. <xsl:choose>
  460. <xsl:when test="starts-with($urifilename, 'file:/')">
  461. <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
  462. </xsl:when>
  463. <xsl:otherwise>
  464. <xsl:value-of select="$urifilename"/>
  465. </xsl:otherwise>
  466. </xsl:choose>
  467. </xsl:variable>
  468. <xsl:value-of select="translate($filename, '/', '\')"/>
  469. </xsl:template>
  470. <xsl:template match="text()" mode="enumerate-images">
  471. </xsl:template>
  472. <xsl:template name="write.filename.enumerate-images">
  473. <xsl:param name="filename"/>
  474. <xsl:choose>
  475. <xsl:when test="function-available('exsl:node-set') and function-available('set:distinct')">
  476. <filename><xsl:value-of select="$filename"/></filename>
  477. </xsl:when>
  478. <xsl:otherwise>
  479. <xsl:value-of select="$filename"/>
  480. <xsl:text>&#10;</xsl:text>
  481. </xsl:otherwise>
  482. </xsl:choose>
  483. </xsl:template>
  484. <!-- ==================================================================== -->
  485. <!-- HHC and HHK files are processed by compiler line by line
  486. and therefore are very sensitive to whitespaces (linefeeds for sure). -->
  487. <xsl:template name="hhc">
  488. <xsl:call-template name="write.chunk">
  489. <xsl:with-param name="filename">
  490. <xsl:if test="$manifest.in.base.dir != 0">
  491. <xsl:value-of select="$chunk.base.dir"/>
  492. </xsl:if>
  493. <xsl:value-of select="$htmlhelp.hhc"/>
  494. </xsl:with-param>
  495. <xsl:with-param name="indent" select="'no'"/>
  496. <xsl:with-param name="content">
  497. <xsl:call-template name="hhc-main"/>
  498. </xsl:with-param>
  499. <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  500. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  501. </xsl:call-template>
  502. </xsl:template>
  503. <xsl:template name="hhc-main">
  504. <HTML>&lf;
  505. <HEAD></HEAD>&lf;
  506. <BODY>&lf;
  507. <xsl:if test="$htmlhelp.hhc.folders.instead.books != 0">
  508. <OBJECT type="text/site properties">&lf;
  509. <param name="ImageType" value="Folder"/>&lf;
  510. </OBJECT>&lf;
  511. </xsl:if>
  512. <xsl:variable name="content">
  513. <xsl:choose>
  514. <xsl:when test="$rootid != ''">
  515. <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
  516. </xsl:when>
  517. <xsl:otherwise>
  518. <xsl:apply-templates select="/" mode="hhc"/>
  519. </xsl:otherwise>
  520. </xsl:choose>
  521. </xsl:variable>
  522. <xsl:choose>
  523. <xsl:when test="$htmlhelp.hhc.show.root != 0">
  524. <UL>&lf;
  525. <xsl:copy-of select="$content"/>
  526. </UL>&lf;
  527. </xsl:when>
  528. <xsl:otherwise>
  529. <xsl:copy-of select="$content"/>
  530. </xsl:otherwise>
  531. </xsl:choose>
  532. </BODY>
  533. </HTML>
  534. </xsl:template>
  535. <xsl:template name="hhc.entry">
  536. <xsl:param name="title">
  537. <xsl:if test="$htmlhelp.autolabel=1">
  538. <xsl:variable name="label.markup">
  539. <xsl:apply-templates select="." mode="label.markup"/>
  540. </xsl:variable>
  541. <xsl:if test="normalize-space($label.markup)">
  542. <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
  543. </xsl:if>
  544. </xsl:if>
  545. <xsl:apply-templates select="." mode="title.markup"/>
  546. </xsl:param>
  547. <LI><OBJECT type="text/sitemap">&lf;
  548. <param name="Name">
  549. <xsl:attribute name="value">
  550. <xsl:value-of select="normalize-space($title)"/>
  551. </xsl:attribute>
  552. </param>&lf;
  553. <param name="Local">
  554. <xsl:attribute name="value">
  555. <xsl:call-template name="href.target.with.base.dir"/>
  556. </xsl:attribute>
  557. </param>
  558. </OBJECT></LI>&lf;
  559. </xsl:template>
  560. <xsl:template match="set" mode="hhc">
  561. <xsl:if test="$htmlhelp.hhc.show.root != 0">
  562. <xsl:call-template name="hhc.entry"/>
  563. </xsl:if>
  564. <xsl:if test="book">
  565. <xsl:variable name="toc.params">
  566. <xsl:call-template name="find.path.params">
  567. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  568. </xsl:call-template>
  569. </xsl:variable>
  570. <UL>
  571. <xsl:if test="contains($toc.params, 'toc') and $htmlhelp.hhc.show.root = 0">
  572. <LI><OBJECT type="text/sitemap">&lf;
  573. <param name="Name">
  574. <xsl:attribute name="value">
  575. <xsl:call-template name="gentext">
  576. <xsl:with-param name="key" select="'TableofContents'"/>
  577. </xsl:call-template>
  578. </xsl:attribute>
  579. </param>&lf;
  580. <param name="Local">
  581. <xsl:attribute name="value">
  582. <xsl:choose>
  583. <xsl:when test="$chunk.tocs.and.lots != 0">
  584. <xsl:apply-templates select="." mode="recursive-chunk-filename">
  585. <xsl:with-param name="recursive" select="true()"/>
  586. </xsl:apply-templates>
  587. <xsl:text>-toc</xsl:text>
  588. <xsl:value-of select="$html.ext"/>
  589. </xsl:when>
  590. <xsl:otherwise>
  591. <xsl:call-template name="href.target.with.base.dir"/>
  592. </xsl:otherwise>
  593. </xsl:choose>
  594. </xsl:attribute>
  595. </param>
  596. </OBJECT></LI>&lf;
  597. </xsl:if>
  598. <xsl:apply-templates select="book" mode="hhc"/>
  599. </UL>&lf;
  600. </xsl:if>
  601. </xsl:template>
  602. <xsl:template match="book" mode="hhc">
  603. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  604. <xsl:call-template name="hhc.entry"/>
  605. </xsl:if>
  606. <xsl:if test="part|reference|preface|chapter|appendix|bibliography|article|colophon|glossary">
  607. <xsl:variable name="toc.params">
  608. <xsl:call-template name="find.path.params">
  609. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  610. </xsl:call-template>
  611. </xsl:variable>
  612. <UL>
  613. <xsl:if test="contains($toc.params, 'toc') and $htmlhelp.hhc.show.root = 0 and not(parent::*)">
  614. <LI><OBJECT type="text/sitemap">&lf;
  615. <param name="Name">
  616. <xsl:attribute name="value">
  617. <xsl:call-template name="gentext">
  618. <xsl:with-param name="key" select="'TableofContents'"/>
  619. </xsl:call-template>
  620. </xsl:attribute>
  621. </param>&lf;
  622. <param name="Local">
  623. <xsl:attribute name="value">
  624. <xsl:choose>
  625. <xsl:when test="$chunk.tocs.and.lots != 0">
  626. <xsl:apply-templates select="." mode="recursive-chunk-filename">
  627. <xsl:with-param name="recursive" select="true()"/>
  628. </xsl:apply-templates>
  629. <xsl:text>-toc</xsl:text>
  630. <xsl:value-of select="$html.ext"/>
  631. </xsl:when>
  632. <xsl:otherwise>
  633. <xsl:call-template name="href.target.with.base.dir"/>
  634. </xsl:otherwise>
  635. </xsl:choose>
  636. </xsl:attribute>
  637. </param>
  638. </OBJECT></LI>&lf;
  639. </xsl:if>
  640. <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon|glossary"
  641. mode="hhc"/>
  642. </UL>&lf;
  643. </xsl:if>
  644. </xsl:template>
  645. <xsl:template match="part|reference|preface|chapter|bibliography|appendix|article|glossary"
  646. mode="hhc">
  647. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  648. <xsl:call-template name="hhc.entry"/>
  649. </xsl:if>
  650. <xsl:if test="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
  651. <UL>&lf;
  652. <xsl:apply-templates
  653. select="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
  654. mode="hhc"/>
  655. </UL>
  656. </xsl:if>
  657. </xsl:template>
  658. <xsl:template match="section" mode="hhc">
  659. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  660. <xsl:call-template name="hhc.entry"/>
  661. </xsl:if>
  662. <xsl:if test="section[count(ancestor::section) &lt; $htmlhelp.hhc.section.depth]|refentry">
  663. <UL>&lf;
  664. <xsl:apply-templates select="section|refentry" mode="hhc"/>
  665. </UL>
  666. </xsl:if>
  667. </xsl:template>
  668. <xsl:template match="sect1" mode="hhc">
  669. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  670. <xsl:call-template name="hhc.entry"/>
  671. </xsl:if>
  672. <xsl:if test="sect2[$htmlhelp.hhc.section.depth > 1]|refentry">
  673. <UL>&lf;
  674. <xsl:apply-templates select="sect2|refentry"
  675. mode="hhc"/>
  676. </UL>
  677. </xsl:if>
  678. </xsl:template>
  679. <xsl:template match="sect2" mode="hhc">
  680. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  681. <xsl:call-template name="hhc.entry"/>
  682. </xsl:if>
  683. <xsl:if test="sect3[$htmlhelp.hhc.section.depth > 2]|refentry">
  684. <UL>&lf;
  685. <xsl:apply-templates select="sect3|refentry"
  686. mode="hhc"/>
  687. </UL>
  688. </xsl:if>
  689. </xsl:template>
  690. <xsl:template match="sect3" mode="hhc">
  691. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  692. <xsl:call-template name="hhc.entry"/>
  693. </xsl:if>
  694. <xsl:if test="sect4[$htmlhelp.hhc.section.depth > 3]|refentry">
  695. <UL>&lf;
  696. <xsl:apply-templates select="sect4|refentry"
  697. mode="hhc"/>
  698. </UL>
  699. </xsl:if>
  700. </xsl:template>
  701. <xsl:template match="sect4" mode="hhc">
  702. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  703. <xsl:call-template name="hhc.entry"/>
  704. </xsl:if>
  705. <xsl:if test="sect5[$htmlhelp.hhc.section.depth > 4]|refentry">
  706. <UL>&lf;
  707. <xsl:apply-templates select="sect5|refentry"
  708. mode="hhc"/>
  709. </UL>
  710. </xsl:if>
  711. </xsl:template>
  712. <xsl:template match="sect5|refentry|colophon|bibliodiv" mode="hhc">
  713. <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
  714. <xsl:call-template name="hhc.entry"/>
  715. </xsl:if>
  716. <xsl:if test="refentry">
  717. <UL>&lf;
  718. <xsl:apply-templates select="refentry"
  719. mode="hhc"/>
  720. </UL>
  721. </xsl:if>
  722. </xsl:template>
  723. <!-- ==================================================================== -->
  724. <xsl:template match="indexterm">
  725. <xsl:choose>
  726. <xsl:when test="$htmlhelp.use.hhk = 0">
  727. <xsl:variable name="primary" select="normalize-space(primary)"/>
  728. <xsl:variable name="secondary" select="normalize-space(secondary)"/>
  729. <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
  730. <xsl:variable name="text">
  731. <xsl:value-of select="$primary"/>
  732. <xsl:if test="secondary">
  733. <xsl:text>, </xsl:text>
  734. <xsl:value-of select="$secondary"/>
  735. </xsl:if>
  736. <xsl:if test="tertiary">
  737. <xsl:text>, </xsl:text>
  738. <xsl:value-of select="$tertiary"/>
  739. </xsl:if>
  740. </xsl:variable>
  741. <xsl:if test="secondary">
  742. <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
  743. <xsl:call-template name="write.indexterm">
  744. <xsl:with-param name="text" select="$primary"/>
  745. </xsl:call-template>
  746. </xsl:if>
  747. </xsl:if>
  748. <xsl:if test="tertiary">
  749. <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and
  750. normalize-space(secondary)=$secondary and not(tertiary)])">
  751. <xsl:call-template name="write.indexterm">
  752. <xsl:with-param name="text" select="concat($primary, ', ', $secondary)"/>
  753. </xsl:call-template>
  754. </xsl:if>
  755. </xsl:if>
  756. <xsl:call-template name="write.indexterm">
  757. <xsl:with-param name="text" select="$text"/>
  758. </xsl:call-template>
  759. </xsl:when>
  760. <xsl:otherwise>
  761. <a>
  762. <xsl:attribute name="name">
  763. <xsl:call-template name="object.id"/>
  764. </xsl:attribute>
  765. </a>
  766. </xsl:otherwise>
  767. </xsl:choose>
  768. </xsl:template>
  769. <xsl:template name="write.indexterm">
  770. <xsl:param name="text"/>
  771. <OBJECT type="application/x-oleobject"
  772. classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
  773. <param name="Keyword" value="{$text}"/>
  774. </OBJECT>
  775. </xsl:template>
  776. <!-- ==================================================================== -->
  777. <xsl:template name="hhk">
  778. <xsl:call-template name="write.chunk">
  779. <xsl:with-param name="filename">
  780. <xsl:if test="$manifest.in.base.dir != 0">
  781. <xsl:value-of select="$chunk.base.dir"/>
  782. </xsl:if>
  783. <xsl:value-of select="$htmlhelp.hhk"/>
  784. </xsl:with-param>
  785. <xsl:with-param name="indent" select="'no'"/>
  786. <xsl:with-param name="content"><xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  787. <HTML>
  788. <HEAD>
  789. <meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
  790. <!-- Sitemap 1.0 -->
  791. </HEAD><BODY>
  792. <OBJECT type="text/site properties">
  793. </OBJECT>
  794. <UL>]]>
  795. </xsl:text>
  796. <xsl:if test="($htmlhelp.use.hhk != 0) and $htmlhelp.generate.index">
  797. <xsl:choose>
  798. <xsl:when test="$rootid != ''">
  799. <xsl:apply-templates select="key('id',$rootid)" mode="hhk"/>
  800. </xsl:when>
  801. <xsl:otherwise>
  802. <xsl:apply-templates select="/" mode="hhk"/>
  803. </xsl:otherwise>
  804. </xsl:choose>
  805. </xsl:if>
  806. <xsl:text disable-output-escaping="yes"><![CDATA[</UL>
  807. </BODY></HTML>]]>
  808. </xsl:text></xsl:with-param>
  809. <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  810. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  811. </xsl:call-template>
  812. </xsl:template>
  813. <xsl:template match="indexterm[@class='endofrange']" mode="hhk"/>
  814. <xsl:template match="indexterm" mode="hhk">
  815. <xsl:variable name="primary" select="normalize-space(primary)"/>
  816. <xsl:variable name="secondary" select="normalize-space(secondary)"/>
  817. <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
  818. <xsl:call-template name="write.indexterm.hhk">
  819. <xsl:with-param name="text" select="$primary"/>
  820. <xsl:with-param name="seealso" select="seealso"/>
  821. </xsl:call-template>
  822. <xsl:if test="secondary">
  823. <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
  824. <xsl:call-template name="write.indexterm.hhk">
  825. <!-- We must create fake entry when there is secondary without primary -->
  826. <xsl:with-param name="text" select="$primary"/>
  827. <xsl:with-param name="seealso" select="$primary"/>
  828. </xsl:call-template>
  829. </xsl:if>
  830. <UL>
  831. <xsl:call-template name="write.indexterm.hhk">
  832. <xsl:with-param name="text" select="$secondary"/>
  833. <xsl:with-param name="seealso" select="secondary/seealso"/>
  834. </xsl:call-template>
  835. <xsl:if test="tertiary">
  836. <UL>&lf;
  837. <xsl:call-template name="write.indexterm.hhk">
  838. <xsl:with-param name="text" select="$tertiary"/>
  839. <xsl:with-param name="seealso" select="tertiary/seealso"/>
  840. </xsl:call-template>
  841. </UL>
  842. </xsl:if>
  843. </UL>
  844. </xsl:if>
  845. </xsl:template>
  846. <xsl:template name="write.indexterm.hhk">
  847. <xsl:param name="text"/>
  848. <xsl:param name="seealso"/>
  849. <LI> <OBJECT type="text/sitemap">&lf;
  850. <param name="Name">
  851. <xsl:attribute name="value">
  852. <xsl:value-of select="$text"/>
  853. </xsl:attribute>
  854. </param>&lf;
  855. <xsl:if test="not(seealso)">
  856. <xsl:variable name="href">
  857. <xsl:call-template name="href.target.with.base.dir"/>
  858. </xsl:variable>
  859. <xsl:variable name="title">
  860. <xsl:call-template name="nearest.title">
  861. <xsl:with-param name="object" select=".."/>
  862. </xsl:call-template>
  863. </xsl:variable>
  864. <param name="Name">
  865. <xsl:attribute name="value">
  866. <xsl:value-of select="$title"/>
  867. </xsl:attribute>
  868. </param>&lf;
  869. <param name="Local">
  870. <xsl:attribute name="value">
  871. <xsl:value-of select="$href"/>
  872. </xsl:attribute>
  873. </param>&lf;
  874. </xsl:if>
  875. <xsl:if test="seealso">
  876. <param name="See Also">
  877. <xsl:attribute name="value">
  878. <xsl:value-of select="$seealso"/>
  879. </xsl:attribute>
  880. </param>&lf;
  881. </xsl:if>
  882. </OBJECT></LI>
  883. </xsl:template>
  884. <xsl:template match="text()" mode="hhk"/>
  885. <xsl:template name="nearest.title">
  886. <xsl:param name="object"/>
  887. <xsl:apply-templates select="$object/ancestor-or-self::*[title][1]" mode="title.markup"/>
  888. </xsl:template>
  889. <!-- ==================================================================== -->
  890. <xsl:template name="hh-map">
  891. <xsl:call-template name="write.text.chunk">
  892. <xsl:with-param name="filename">
  893. <xsl:if test="$manifest.in.base.dir != 0">
  894. <xsl:value-of select="$chunk.base.dir"/>
  895. </xsl:if>
  896. <xsl:value-of select="$htmlhelp.map.file"/>
  897. </xsl:with-param>
  898. <xsl:with-param name="method" select="'text'"/>
  899. <xsl:with-param name="content">
  900. <xsl:choose>
  901. <xsl:when test="$rootid != ''">
  902. <xsl:apply-templates select="key('id',$rootid)" mode="hh-map"/>
  903. </xsl:when>
  904. <xsl:otherwise>
  905. <xsl:apply-templates select="/" mode="hh-map"/>
  906. </xsl:otherwise>
  907. </xsl:choose>
  908. </xsl:with-param>
  909. <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  910. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  911. </xsl:call-template>
  912. </xsl:template>
  913. <xsl:template match="processing-instruction('dbhh')" mode="hh-map">
  914. <xsl:variable name="topicname">
  915. <xsl:call-template name="pi-attribute">
  916. <xsl:with-param name="pis"
  917. select="."/>
  918. <xsl:with-param name="attribute" select="'topicname'"/>
  919. </xsl:call-template>
  920. </xsl:variable>
  921. <xsl:variable name="topicid">
  922. <xsl:call-template name="pi-attribute">
  923. <xsl:with-param name="pis"
  924. select="."/>
  925. <xsl:with-param name="attribute" select="'topicid'"/>
  926. </xsl:call-template>
  927. </xsl:variable>
  928. <xsl:text>#define </xsl:text>
  929. <xsl:value-of select="$topicname"/>
  930. <xsl:text>&#9;</xsl:text>
  931. <xsl:value-of select="$topicid"/>
  932. <xsl:text>&#xA;</xsl:text>
  933. </xsl:template>
  934. <xsl:template match="text()" mode="hh-map"/>
  935. <!-- ==================================================================== -->
  936. <xsl:template name="hh-alias">
  937. <xsl:call-template name="write.text.chunk">
  938. <xsl:with-param name="filename">
  939. <xsl:if test="$manifest.in.base.dir != 0">
  940. <xsl:value-of select="$chunk.base.dir"/>
  941. </xsl:if>
  942. <xsl:value-of select="$htmlhelp.alias.file"/>
  943. </xsl:with-param>
  944. <xsl:with-param name="method" select="'text'"/>
  945. <xsl:with-param name="content">
  946. <xsl:choose>
  947. <xsl:when test="$rootid != ''">
  948. <xsl:apply-templates select="key('id',$rootid)" mode="hh-alias"/>
  949. </xsl:when>
  950. <xsl:otherwise>
  951. <xsl:apply-templates select="/" mode="hh-alias"/>
  952. </xsl:otherwise>
  953. </xsl:choose>
  954. </xsl:with-param>
  955. <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  956. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  957. </xsl:call-template>
  958. </xsl:template>
  959. <xsl:template match="processing-instruction('dbhh')" mode="hh-alias">
  960. <xsl:variable name="topicname">
  961. <xsl:call-template name="pi-attribute">
  962. <xsl:with-param name="pis"
  963. select="."/>
  964. <xsl:with-param name="attribute" select="'topicname'"/>
  965. </xsl:call-template>
  966. </xsl:variable>
  967. <xsl:variable name="href">
  968. <xsl:call-template name="href.target.with.base.dir">
  969. <xsl:with-param name="object" select=".."/>
  970. </xsl:call-template>
  971. </xsl:variable>
  972. <xsl:value-of select="$topicname"/>
  973. <xsl:text>=</xsl:text>
  974. <!-- Some versions of HH doesn't like fragment identifires, but some does. -->
  975. <!-- <xsl:value-of select="substring-before(concat($href, '#'), '#')"/> -->
  976. <xsl:value-of select="$href"/>
  977. <xsl:text>&#xA;</xsl:text>
  978. </xsl:template>
  979. <xsl:template match="text()" mode="hh-alias"/>
  980. <!-- ==================================================================== -->
  981. <!-- This code can be used to convert any number to hexadecimal format -->
  982. <h:hex>
  983. <d>0</d>
  984. <d>1</d>
  985. <d>2</d>
  986. <d>3</d>
  987. <d>4</d>
  988. <d>5</d>
  989. <d>6</d>
  990. <d>7</d>
  991. <d>8</d>
  992. <d>9</d>
  993. <d>A</d>
  994. <d>B</d>
  995. <d>C</d>
  996. <d>D</d>
  997. <d>E</d>
  998. <d>F</d>
  999. </h:hex>
  1000. <xsl:template name="toHex">
  1001. <xsl:param name="n" select="0"/>
  1002. <xsl:param name="digit" select="$n mod 16"/>
  1003. <xsl:param name="rest" select="floor($n div 16)"/>
  1004. <xsl:if test="$rest > 0">
  1005. <xsl:call-template name="toHex">
  1006. <xsl:with-param name="n" select="$rest"/>
  1007. </xsl:call-template>
  1008. </xsl:if>
  1009. <xsl:value-of select="document('')//h:hex/d[$digit+1]"/>
  1010. </xsl:template>
  1011. <!-- ==================================================================== -->
  1012. <!-- Modification to standard HTML stylesheets -->
  1013. <!-- There are links from ToC pane to bibliodivs, so there must be anchor -->
  1014. <xsl:template match="bibliodiv/title">
  1015. <h3 class="{name(.)}">
  1016. <xsl:call-template name="anchor">
  1017. <xsl:with-param name="node" select=".."/>
  1018. <xsl:with-param name="conditional" select="0"/>
  1019. </xsl:call-template>
  1020. <xsl:apply-templates/>
  1021. </h3>
  1022. </xsl:template>
  1023. </xsl:stylesheet>