home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _70C6EB1CFD3646E5B17873F6CFDBDB96 < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  38.9 KB  |  1,049 lines

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