2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY lf '<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</xsl:text>'>
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"
10 xmlns:ng="http://docbook.org/docbook-ng"
11 xmlns:db="http://docbook.org/ns/docbook"
13 exclude-result-prefixes="doc exsl set h db ng">
15 <!-- ********************************************************************
16 $Id: htmlhelp-common.xsl 8400 2009-04-08 07:44:54Z bobstayton $
17 ******************************************************************** -->
19 <!-- ==================================================================== -->
20 <!-- Customizations of standard HTML stylesheet parameters -->
22 <!-- no navigation on pages by default, HTML Help provides its own navigation controls -->
23 <xsl:param name="suppress.navigation" select="1"/>
25 <!-- no separate HTML page with index, index is built inside CHM index pane -->
26 <xsl:param name="generate.index" select="0"/>
28 <!-- ==================================================================== -->
30 <xsl:param name="htmlhelp.generate.index" select="//indexterm[1]|//db:indexterm[1]|//ng:indexterm[1]"/>
32 <!-- Set up HTML Help flag -->
33 <xsl:variable name="htmlhelp.output" select="1"/>
35 <!-- ==================================================================== -->
37 <xsl:template match="/">
39 <!-- * Get a title for current doc so that we let the user -->
40 <!-- * know what document we are processing at this point. -->
41 <xsl:variable name="doc.title">
42 <xsl:call-template name="get.doc.title"/>
45 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
46 toss the namespace and continue. Use the docbook5 namespaced
47 stylesheets for DocBook5 if you don't want to use this feature.-->
48 <xsl:when test="$exsl.node.set.available != 0
49 and (*/self::ng:* or */self::db:*)">
50 <xsl:call-template name="log.message">
51 <xsl:with-param name="level">Note</xsl:with-param>
52 <xsl:with-param name="source" select="$doc.title"/>
53 <xsl:with-param name="context-desc">
54 <xsl:text>namesp. cut</xsl:text>
56 <xsl:with-param name="message">
57 <xsl:text>stripped namespace before processing</xsl:text>
60 <xsl:variable name="nons">
61 <xsl:apply-templates mode="stripNS"/>
63 <xsl:call-template name="log.message">
64 <xsl:with-param name="level">Note</xsl:with-param>
65 <xsl:with-param name="source" select="$doc.title"/>
66 <xsl:with-param name="context-desc">
67 <xsl:text>namesp. cut</xsl:text>
69 <xsl:with-param name="message">
70 <xsl:text>processing stripped document</xsl:text>
73 <xsl:apply-templates select="exsl:node-set($nons)"/>
76 <xsl:if test="$htmlhelp.only != 1">
78 <xsl:when test="$rootid != ''">
80 <xsl:when test="count(key('id',$rootid)) = 0">
81 <xsl:message terminate="yes">
82 <xsl:text>ID '</xsl:text>
83 <xsl:value-of select="$rootid"/>
84 <xsl:text>' not found in document.</xsl:text>
88 <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
89 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
94 <xsl:if test="$collect.xref.targets = 'yes' or
95 $collect.xref.targets = 'only'">
96 <xsl:apply-templates select="/" mode="collect.targets"/>
98 <xsl:if test="$collect.xref.targets != 'only'">
99 <xsl:apply-templates select="/" mode="process.root"/>
106 <xsl:if test="$collect.xref.targets != 'only'">
107 <xsl:call-template name="hhp"/>
108 <xsl:call-template name="hhc"/>
109 <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
110 ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
111 <xsl:call-template name="hh-map"/>
112 <xsl:call-template name="hh-alias"/>
114 <xsl:if test="$htmlhelp.generate.index">
115 <xsl:call-template name="hhk"/>
122 <!-- ==================================================================== -->
124 <xsl:template name="hhp">
125 <xsl:call-template name="write.text.chunk">
126 <xsl:with-param name="filename">
127 <xsl:if test="$manifest.in.base.dir != 0">
128 <xsl:value-of select="$base.dir"/>
130 <xsl:value-of select="$htmlhelp.hhp"/>
132 <xsl:with-param name="method" select="'text'"/>
133 <xsl:with-param name="content">
134 <xsl:call-template name="hhp-main"/>
136 <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
137 <xsl:with-param name="quiet" select="$chunk.quietly"/>
141 <!-- ==================================================================== -->
142 <xsl:template name="hhp-main">
144 <xsl:variable name="raw.help.title">
146 <xsl:when test="$htmlhelp.title = ''">
148 <xsl:when test="$rootid != ''">
149 <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
152 <xsl:apply-templates select="/*" mode="title.markup"/>
157 <xsl:value-of select="$htmlhelp.title"/>
162 <xsl:variable name="help.title" select="normalize-space($raw.help.title)"/>
164 <xsl:variable name="default.topic">
166 <xsl:when test="$htmlhelp.default.topic != ''">
167 <xsl:value-of select="$htmlhelp.default.topic"/>
170 <xsl:call-template name="make-relative-filename">
171 <xsl:with-param name="base.dir">
172 <xsl:if test="$manifest.in.base.dir = 0">
173 <xsl:value-of select="$base.dir"/>
176 <xsl:with-param name="base.name">
178 <xsl:when test="$rootid != ''">
179 <xsl:apply-templates select="key('id',$rootid)" mode="chunk-filename"/>
182 <xsl:apply-templates select="/" mode="chunk-filename"/>
190 <xsl:variable name="xnavigation">
191 <xsl:text>0x</xsl:text>
192 <xsl:call-template name="toHex">
193 <xsl:with-param name="n" select="9504 + $htmlhelp.show.menu * 65536
194 + $htmlhelp.show.advanced.search * 131072
195 + $htmlhelp.show.favorities * 4096
196 + (1 - $htmlhelp.show.toolbar.text) * 64
197 + $htmlhelp.remember.window.position * 262144"/>
200 <xsl:variable name="xbuttons">
201 <xsl:text>0x</xsl:text>
202 <xsl:call-template name="toHex">
203 <xsl:with-param name="n" select="0 + $htmlhelp.button.hideshow * 2
204 + $htmlhelp.button.back * 4
205 + $htmlhelp.button.forward * 8
206 + $htmlhelp.button.stop * 16
207 + $htmlhelp.button.refresh * 32
208 + $htmlhelp.button.home * 64
209 + $htmlhelp.button.options * 4096
210 + $htmlhelp.button.print * 8192
211 + $htmlhelp.button.locate * 2048
212 + $htmlhelp.button.jump1 * 262144
213 + $htmlhelp.button.jump2 * 524288
214 + $htmlhelp.button.next * 2097152
215 + $htmlhelp.button.prev * 4194304
216 + $htmlhelp.button.zoom * 1048576"/>
221 <xsl:if test="$htmlhelp.generate.index">
222 <xsl:text>Auto Index=Yes
224 <xsl:if test="$htmlhelp.hhc.binary != 0">
225 <xsl:text>Binary TOC=Yes
227 <xsl:text>Compatibility=1.1 or later
228 Compiled file=</xsl:text><xsl:value-of select="$htmlhelp.chm"/><xsl:text>
229 Contents file=</xsl:text><xsl:value-of select="$htmlhelp.hhc"/><xsl:text>
231 <xsl:if test="$htmlhelp.hhp.window != ''">
232 <xsl:text>Default Window=</xsl:text><xsl:value-of select="$htmlhelp.hhp.window"/><xsl:text>
234 <xsl:text>Default topic=</xsl:text><xsl:value-of select="$default.topic"/>
236 Display compile progress=</xsl:text>
238 <xsl:when test="$htmlhelp.display.progress != 1">
239 <xsl:text>No</xsl:text>
242 <xsl:text>Yes</xsl:text>
248 <xsl:if test="$htmlhelp.generate.index">
249 <xsl:text>Index file=</xsl:text><xsl:value-of select="$htmlhelp.hhk"/><xsl:text>
251 <xsl:text>Language=</xsl:text>
252 <xsl:for-each select="*"> <!-- Change context from / to root element -->
253 <xsl:call-template name="gentext.template">
254 <xsl:with-param name="context" select="'htmlhelp'"/>
255 <xsl:with-param name="name" select="'langcode'"/>
260 <xsl:value-of select="$help.title"/>
262 Enhanced decompilation=</xsl:text>
264 <xsl:when test="$htmlhelp.enhanced.decompilation != 0">
265 <xsl:text>Yes</xsl:text>
268 <xsl:text>No</xsl:text>
272 <xsl:if test="$htmlhelp.hhp.window != ''">
277 <xsl:value-of select="$htmlhelp.hhp.window"/>
278 <xsl:text>="</xsl:text>
279 <xsl:value-of select="$help.title"/>
280 <xsl:text>","</xsl:text><xsl:value-of select="$htmlhelp.hhc"/>
281 <xsl:text>",</xsl:text>
282 <xsl:if test="$htmlhelp.generate.index">
283 <xsl:text>"</xsl:text>
284 <xsl:value-of select="$htmlhelp.hhk"/>
285 <xsl:text>"</xsl:text>
287 <xsl:text>,"</xsl:text>
288 <xsl:value-of select="$default.topic"/>
289 <xsl:text>",</xsl:text>
290 <xsl:text>"</xsl:text>
292 <xsl:when test="$htmlhelp.button.home != 0">
293 <xsl:value-of select="$htmlhelp.button.home.url"/>
296 <xsl:value-of select="$default.topic"/>
299 <xsl:text>"</xsl:text>
300 <xsl:text>,</xsl:text>
301 <xsl:if test="$htmlhelp.button.jump1 != 0">
302 <xsl:text>"</xsl:text>
303 <xsl:value-of select="$htmlhelp.button.jump1.url"/>
304 <xsl:text>"</xsl:text>
306 <xsl:text>,</xsl:text>
307 <xsl:if test="$htmlhelp.button.jump1 != 0">
308 <xsl:text>"</xsl:text>
309 <xsl:value-of select="$htmlhelp.button.jump1.title"/>
310 <xsl:text>"</xsl:text>
312 <xsl:text>,</xsl:text>
313 <xsl:if test="$htmlhelp.button.jump2 != 0">
314 <xsl:text>"</xsl:text>
315 <xsl:value-of select="$htmlhelp.button.jump2.url"/>
316 <xsl:text>"</xsl:text>
318 <xsl:text>,</xsl:text>
319 <xsl:if test="$htmlhelp.button.jump2 != 0">
320 <xsl:text>"</xsl:text>
321 <xsl:value-of select="$htmlhelp.button.jump2.title"/>
322 <xsl:text>"</xsl:text>
324 <xsl:text>,</xsl:text>
325 <xsl:value-of select="$xnavigation"/>
326 <xsl:text>,</xsl:text><xsl:value-of select="$htmlhelp.hhc.width"/><xsl:text>,</xsl:text>
327 <xsl:value-of select="$xbuttons"/>
328 <xsl:text>,</xsl:text><xsl:value-of select="$htmlhelp.window.geometry"/><xsl:text>,,,,,,,0
333 Needs more investigation to generate propetly all fields
334 <xsl:text>search="</xsl:text>
335 <xsl:value-of select="normalize-space(//title[1])"/>
336 <xsl:text>","toc.hhc","index.hhk","</xsl:text>
337 <xsl:value-of select="$root.filename"/>
338 <xsl:text>.html","</xsl:text>
339 <xsl:value-of select="$root.filename"/>
340 <xsl:text>.html",,,,,</xsl:text>
341 <xsl:value-of select="$xnavigation"/>
342 <xsl:text>,</xsl:text>
343 <xsl:value-of select="$htmlhelp.hhc.width"/>
344 <xsl:text>,</xsl:text>
345 <xsl:value-of select="$xbuttons"/>
346 <xsl:text>,</xsl:text>
347 <xsl:value-of select="$htmlhelp.window.geometry"/>
352 <xsl:if test="$htmlhelp.hhp.windows">
353 <xsl:value-of select="$htmlhelp.hhp.windows"/>
361 <xsl:when test="$rootid != ''">
362 <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-files"/>
365 <xsl:apply-templates select="/" mode="enumerate-files"/>
369 <xsl:if test="$htmlhelp.enumerate.images">
370 <xsl:variable name="imagelist">
372 <xsl:when test="$rootid != ''">
373 <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-images"/>
376 <xsl:apply-templates select="/" mode="enumerate-images"/>
381 <xsl:when test="$exsl.node.set.available != 0
382 and function-available('set:distinct')">
383 <xsl:for-each select="set:distinct(exsl:node-set($imagelist)/filename)">
384 <xsl:value-of select="."/>
385 <xsl:text> </xsl:text>
389 <xsl:value-of select="$imagelist"/>
394 <xsl:if test="($htmlhelp.force.map.and.alias != 0) or
395 ($rootid = '' and //processing-instruction('dbhh')) or
396 ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
399 #include </xsl:text><xsl:value-of select="$htmlhelp.alias.file"/><xsl:text>
402 #include </xsl:text><xsl:value-of select="$htmlhelp.map.file"/><xsl:text>
406 <xsl:value-of select="$htmlhelp.hhp.tail"/>
409 <!-- ==================================================================== -->
411 <xsl:template match="graphic|inlinegraphic[@format!='linespecific']" mode="enumerate-images">
412 <xsl:call-template name="write.filename.enumerate-images">
413 <xsl:with-param name="filename">
414 <xsl:call-template name="mediaobject.filename.enumerate-images">
415 <xsl:with-param name="object" select="."/>
421 <xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
422 <xsl:call-template name="select.mediaobject.enumerate-images"/>
425 <xsl:template name="select.mediaobject.enumerate-images">
426 <xsl:param name="olist"
427 select="imageobject|imageobjectco
428 |videoobject|audioobject|textobject"/>
429 <xsl:param name="count">1</xsl:param>
431 <xsl:if test="$count <= count($olist)">
432 <xsl:variable name="object" select="$olist[position()=$count]"/>
434 <xsl:variable name="useobject">
436 <!-- The phrase is never used -->
437 <xsl:when test="name($object)='textobject' and $object/phrase">
438 <xsl:text>0</xsl:text>
440 <!-- The first textobject is a reasonable fallback (but not for image in HH) -->
441 <xsl:when test="name($object)='textobject'">
442 <xsl:text>0</xsl:text>
444 <!-- If there's only one object, use it -->
445 <xsl:when test="$count = 1 and count($olist) = 1">
446 <xsl:text>1</xsl:text>
448 <!-- Otherwise, see if this one is a useable graphic -->
451 <!-- peek inside imageobjectco to simplify the test -->
452 <xsl:when test="local-name($object) = 'imageobjectco'">
453 <xsl:call-template name="is.acceptable.mediaobject">
454 <xsl:with-param name="object" select="$object/imageobject"/>
458 <xsl:call-template name="is.acceptable.mediaobject">
459 <xsl:with-param name="object" select="$object"/>
468 <xsl:when test="$useobject='1' and $object[not(*/@format='linespecific')]">
469 <xsl:call-template name="write.filename.enumerate-images">
470 <xsl:with-param name="filename">
471 <xsl:call-template name="mediaobject.filename.enumerate-images">
472 <xsl:with-param name="object" select="$object"/>
478 <xsl:call-template name="select.mediaobject.enumerate-images">
479 <xsl:with-param name="olist" select="$olist"/>
480 <xsl:with-param name="count" select="$count + 1"/>
487 <xsl:template name="mediaobject.filename.enumerate-images">
488 <xsl:param name="object"/>
490 <xsl:variable name="urifilename">
491 <xsl:call-template name="mediaobject.filename">
492 <xsl:with-param name="object" select="$object"/>
496 <xsl:variable name="filename">
498 <xsl:when test="starts-with($urifilename, 'file:/')">
499 <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
502 <xsl:value-of select="$urifilename"/>
507 <xsl:value-of select="translate($filename, '/', '\')"/>
511 <xsl:template match="text()" mode="enumerate-images">
514 <xsl:template name="write.filename.enumerate-images">
515 <xsl:param name="filename"/>
517 <xsl:when test="function-available('exsl:node-set') and function-available('set:distinct')">
518 <filename><xsl:value-of select="$filename"/></filename>
521 <xsl:value-of select="$filename"/>
522 <xsl:text> </xsl:text>
527 <!-- ==================================================================== -->
529 <!-- HHC and HHK files are processed by compiler line by line
530 and therefore are very sensitive to whitespaces (linefeeds for sure). -->
532 <xsl:template name="hhc">
533 <xsl:call-template name="write.chunk">
534 <xsl:with-param name="filename">
535 <xsl:if test="$manifest.in.base.dir != 0">
536 <xsl:value-of select="$base.dir"/>
538 <xsl:value-of select="$htmlhelp.hhc"/>
540 <xsl:with-param name="indent" select="'no'"/>
541 <xsl:with-param name="content">
542 <xsl:call-template name="hhc-main"/>
544 <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
545 <xsl:with-param name="quiet" select="$chunk.quietly"/>
549 <xsl:template name="hhc-main">
553 <xsl:if test="$htmlhelp.hhc.folders.instead.books != 0">
554 <OBJECT type="text/site properties">&lf;
555 <param name="ImageType" value="Folder"/>&lf;
558 <xsl:variable name="content">
560 <xsl:when test="$rootid != ''">
561 <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
564 <xsl:apply-templates select="/" mode="hhc"/>
570 <xsl:when test="$htmlhelp.hhc.show.root != 0">
572 <xsl:copy-of select="$content"/>
576 <xsl:copy-of select="$content"/>
584 <xsl:template name="hhc.entry">
585 <xsl:param name="title">
586 <xsl:if test="$htmlhelp.autolabel=1">
587 <xsl:variable name="label.markup">
588 <xsl:apply-templates select="." mode="label.markup"/>
590 <xsl:if test="normalize-space($label.markup)">
591 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
594 <xsl:apply-templates select="." mode="title.markup"/>
597 <LI><OBJECT type="text/sitemap">&lf;
599 <xsl:attribute name="value">
600 <xsl:value-of select="normalize-space($title)"/>
604 <xsl:attribute name="value">
605 <xsl:call-template name="href.target.with.base.dir"/>
611 <xsl:template match="set" mode="hhc">
612 <xsl:if test="$htmlhelp.hhc.show.root != 0">
613 <xsl:call-template name="hhc.entry"/>
616 <xsl:variable name="toc.params">
617 <xsl:call-template name="find.path.params">
618 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
622 <xsl:if test="contains($toc.params, 'toc') and $htmlhelp.hhc.show.root = 0">
623 <LI><OBJECT type="text/sitemap">&lf;
625 <xsl:attribute name="value">
626 <xsl:call-template name="gentext">
627 <xsl:with-param name="key" select="'TableofContents'"/>
632 <xsl:attribute name="value">
634 <xsl:when test="$chunk.tocs.and.lots != 0">
635 <xsl:apply-templates select="." mode="recursive-chunk-filename">
636 <xsl:with-param name="recursive" select="true()"/>
637 </xsl:apply-templates>
638 <xsl:text>-toc</xsl:text>
639 <xsl:value-of select="$html.ext"/>
642 <xsl:call-template name="href.target.with.base.dir"/>
649 <xsl:apply-templates select="book" mode="hhc"/>
654 <xsl:template match="book" mode="hhc">
655 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
656 <xsl:call-template name="hhc.entry"/>
658 <xsl:if test="part|reference|preface|chapter|appendix|bibliography|article|colophon|glossary">
659 <xsl:variable name="toc.params">
660 <xsl:call-template name="find.path.params">
661 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
665 <xsl:if test="contains($toc.params, 'toc') and $htmlhelp.hhc.show.root = 0 and not(parent::*)">
666 <LI><OBJECT type="text/sitemap">&lf;
668 <xsl:attribute name="value">
669 <xsl:call-template name="gentext">
670 <xsl:with-param name="key" select="'TableofContents'"/>
675 <xsl:attribute name="value">
677 <xsl:when test="$chunk.tocs.and.lots != 0">
678 <xsl:apply-templates select="." mode="recursive-chunk-filename">
679 <xsl:with-param name="recursive" select="true()"/>
680 </xsl:apply-templates>
681 <xsl:text>-toc</xsl:text>
682 <xsl:value-of select="$html.ext"/>
685 <xsl:call-template name="href.target.with.base.dir"/>
692 <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon|glossary"
698 <xsl:template match="part|reference|preface|chapter|bibliography|appendix|article|glossary"
700 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
701 <xsl:call-template name="hhc.entry"/>
703 <xsl:if test="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
706 select="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
712 <xsl:template match="section" mode="hhc">
713 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
714 <xsl:call-template name="hhc.entry"/>
716 <xsl:if test="section[count(ancestor::section) < $htmlhelp.hhc.section.depth]|refentry">
718 <xsl:apply-templates select="section|refentry" mode="hhc"/>
723 <xsl:template match="sect1" mode="hhc">
724 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
725 <xsl:call-template name="hhc.entry"/>
727 <xsl:if test="sect2[$htmlhelp.hhc.section.depth > 1]|refentry">
729 <xsl:apply-templates select="sect2|refentry"
735 <xsl:template match="sect2" mode="hhc">
736 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
737 <xsl:call-template name="hhc.entry"/>
739 <xsl:if test="sect3[$htmlhelp.hhc.section.depth > 2]|refentry">
741 <xsl:apply-templates select="sect3|refentry"
747 <xsl:template match="sect3" mode="hhc">
748 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
749 <xsl:call-template name="hhc.entry"/>
751 <xsl:if test="sect4[$htmlhelp.hhc.section.depth > 3]|refentry">
753 <xsl:apply-templates select="sect4|refentry"
759 <xsl:template match="sect4" mode="hhc">
760 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
761 <xsl:call-template name="hhc.entry"/>
763 <xsl:if test="sect5[$htmlhelp.hhc.section.depth > 4]|refentry">
765 <xsl:apply-templates select="sect5|refentry"
771 <xsl:template match="sect5|refentry|colophon|bibliodiv" mode="hhc">
772 <xsl:if test="$htmlhelp.hhc.show.root != 0 or parent::*">
773 <xsl:call-template name="hhc.entry"/>
775 <xsl:if test="refentry">
777 <xsl:apply-templates select="refentry"
783 <!-- ==================================================================== -->
785 <xsl:template match="indexterm">
787 <xsl:when test="$htmlhelp.use.hhk = 0">
789 <xsl:variable name="primary" select="normalize-space(primary)"/>
790 <xsl:variable name="secondary" select="normalize-space(secondary)"/>
791 <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
793 <xsl:variable name="text">
794 <xsl:value-of select="$primary"/>
795 <xsl:if test="secondary">
796 <xsl:text>, </xsl:text>
797 <xsl:value-of select="$secondary"/>
799 <xsl:if test="tertiary">
800 <xsl:text>, </xsl:text>
801 <xsl:value-of select="$tertiary"/>
805 <xsl:if test="secondary">
806 <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
807 <xsl:call-template name="write.indexterm">
808 <xsl:with-param name="text" select="$primary"/>
813 <xsl:if test="tertiary">
814 <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and
815 normalize-space(secondary)=$secondary and not(tertiary)])">
816 <xsl:call-template name="write.indexterm">
817 <xsl:with-param name="text" select="concat($primary, ', ', $secondary)"/>
822 <xsl:call-template name="write.indexterm">
823 <xsl:with-param name="text" select="$text"/>
829 <xsl:attribute name="name">
830 <xsl:call-template name="object.id"/>
838 <xsl:template name="write.indexterm">
839 <xsl:param name="text"/>
840 <OBJECT type="application/x-oleobject"
841 classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
842 <param name="Keyword" value="{$text}"/>
846 <!-- ==================================================================== -->
848 <xsl:template name="hhk">
849 <xsl:call-template name="write.chunk">
850 <xsl:with-param name="filename">
851 <xsl:if test="$manifest.in.base.dir != 0">
852 <xsl:value-of select="$base.dir"/>
854 <xsl:value-of select="$htmlhelp.hhk"/>
856 <xsl:with-param name="indent" select="'no'"/>
857 <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">
860 <meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
863 <OBJECT type="text/site properties">
867 <xsl:if test="($htmlhelp.use.hhk != 0) and $htmlhelp.generate.index">
869 <xsl:when test="$rootid != ''">
870 <xsl:apply-templates select="key('id',$rootid)" mode="hhk"/>
873 <xsl:apply-templates select="/" mode="hhk"/>
877 <xsl:text disable-output-escaping="yes"><![CDATA[</UL>
879 </xsl:text></xsl:with-param>
880 <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
881 <xsl:with-param name="quiet" select="$chunk.quietly"/>
885 <xsl:template match="indexterm[@class='endofrange']" mode="hhk"/>
887 <xsl:template match="indexterm" mode="hhk">
888 <xsl:variable name="primary" select="normalize-space(primary)"/>
889 <xsl:variable name="secondary" select="normalize-space(secondary)"/>
890 <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
892 <xsl:call-template name="write.indexterm.hhk">
893 <xsl:with-param name="text" select="$primary"/>
894 <xsl:with-param name="seealso" select="seealso"/>
897 <xsl:if test="secondary">
898 <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
899 <xsl:call-template name="write.indexterm.hhk">
900 <!-- We must create fake entry when there is secondary without primary -->
901 <xsl:with-param name="text" select="$primary"/>
902 <xsl:with-param name="seealso" select="$primary"/>
906 <xsl:call-template name="write.indexterm.hhk">
907 <xsl:with-param name="text" select="$secondary"/>
908 <xsl:with-param name="seealso" select="secondary/seealso"/>
910 <xsl:if test="tertiary">
912 <xsl:call-template name="write.indexterm.hhk">
913 <xsl:with-param name="text" select="$tertiary"/>
914 <xsl:with-param name="seealso" select="tertiary/seealso"/>
923 <xsl:template name="write.indexterm.hhk">
924 <xsl:param name="text"/>
925 <xsl:param name="seealso"/>
927 <LI> <OBJECT type="text/sitemap">&lf;
929 <xsl:attribute name="value">
930 <xsl:value-of select="$text"/>
934 <xsl:if test="not(seealso)">
935 <xsl:variable name="href">
936 <xsl:call-template name="href.target.with.base.dir"/>
938 <xsl:variable name="title">
939 <xsl:call-template name="nearest.title">
940 <xsl:with-param name="object" select=".."/>
945 <xsl:attribute name="value">
946 <xsl:value-of select="$title"/>
950 <xsl:attribute name="value">
951 <xsl:value-of select="$href"/>
956 <xsl:if test="seealso">
957 <param name="See Also">
958 <xsl:attribute name="value">
959 <xsl:value-of select="$seealso"/>
966 <xsl:template match="text()" mode="hhk"/>
968 <xsl:template name="nearest.title">
969 <xsl:param name="object"/>
970 <xsl:apply-templates select="$object/ancestor-or-self::*[title][1]" mode="title.markup"/>
973 <!-- ==================================================================== -->
975 <xsl:template name="hh-map">
976 <xsl:call-template name="write.text.chunk">
977 <xsl:with-param name="filename">
978 <xsl:if test="$manifest.in.base.dir != 0">
979 <xsl:value-of select="$base.dir"/>
981 <xsl:value-of select="$htmlhelp.map.file"/>
983 <xsl:with-param name="method" select="'text'"/>
984 <xsl:with-param name="content">
986 <xsl:when test="$rootid != ''">
987 <xsl:apply-templates select="key('id',$rootid)" mode="hh-map"/>
990 <xsl:apply-templates select="/" mode="hh-map"/>
994 <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
995 <xsl:with-param name="quiet" select="$chunk.quietly"/>
999 <xsl:template match="processing-instruction('dbhh')" mode="hh-map">
1000 <xsl:variable name="topicname">
1001 <xsl:call-template name="pi-attribute">
1002 <xsl:with-param name="pis"
1004 <xsl:with-param name="attribute" select="'topicname'"/>
1005 </xsl:call-template>
1007 <xsl:variable name="topicid">
1008 <xsl:call-template name="pi-attribute">
1009 <xsl:with-param name="pis"
1011 <xsl:with-param name="attribute" select="'topicid'"/>
1012 </xsl:call-template>
1014 <xsl:text>#define </xsl:text>
1015 <xsl:value-of select="$topicname"/>
1016 <xsl:text>	</xsl:text>
1017 <xsl:value-of select="$topicid"/>
1018 <xsl:text>
</xsl:text>
1021 <xsl:template match="text()" mode="hh-map"/>
1023 <!-- ==================================================================== -->
1025 <xsl:template name="hh-alias">
1026 <xsl:call-template name="write.text.chunk">
1027 <xsl:with-param name="filename">
1028 <xsl:if test="$manifest.in.base.dir != 0">
1029 <xsl:value-of select="$base.dir"/>
1031 <xsl:value-of select="$htmlhelp.alias.file"/>
1033 <xsl:with-param name="method" select="'text'"/>
1034 <xsl:with-param name="content">
1036 <xsl:when test="$rootid != ''">
1037 <xsl:apply-templates select="key('id',$rootid)" mode="hh-alias"/>
1040 <xsl:apply-templates select="/" mode="hh-alias"/>
1044 <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
1045 <xsl:with-param name="quiet" select="$chunk.quietly"/>
1046 </xsl:call-template>
1049 <xsl:template match="processing-instruction('dbhh')" mode="hh-alias">
1050 <xsl:variable name="topicname">
1051 <xsl:call-template name="pi-attribute">
1052 <xsl:with-param name="pis"
1054 <xsl:with-param name="attribute" select="'topicname'"/>
1055 </xsl:call-template>
1057 <xsl:variable name="href">
1058 <xsl:call-template name="href.target.with.base.dir">
1059 <xsl:with-param name="object" select=".."/>
1060 </xsl:call-template>
1062 <xsl:value-of select="$topicname"/>
1063 <xsl:text>=</xsl:text>
1064 <!-- Some versions of HH doesn't like fragment identifires, but some does. -->
1065 <!-- <xsl:value-of select="substring-before(concat($href, '#'), '#')"/> -->
1066 <xsl:value-of select="$href"/>
1067 <xsl:text>
</xsl:text>
1070 <xsl:template match="text()" mode="hh-alias"/>
1072 <!-- ==================================================================== -->
1073 <!-- This code can be used to convert any number to hexadecimal format -->
1094 <xsl:template name="toHex">
1095 <xsl:param name="n" select="0"/>
1096 <xsl:param name="digit" select="$n mod 16"/>
1097 <xsl:param name="rest" select="floor($n div 16)"/>
1098 <xsl:if test="$rest > 0">
1099 <xsl:call-template name="toHex">
1100 <xsl:with-param name="n" select="$rest"/>
1101 </xsl:call-template>
1103 <xsl:value-of select="document('')//h:hex/d[$digit+1]"/>
1106 <!-- ==================================================================== -->
1107 <!-- Modification to standard HTML stylesheets -->
1109 <!-- There are links from ToC pane to bibliodivs, so there must be anchor -->
1110 <xsl:template match="bibliodiv/title">
1111 <h3 class="{name(.)}">
1112 <xsl:call-template name="anchor">
1113 <xsl:with-param name="node" select=".."/>
1114 <xsl:with-param name="conditional" select="0"/>
1115 </xsl:call-template>
1116 <xsl:apply-templates/>