profile-htmlhelp-common.xsl 38 KB

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