2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
4 xmlns:ng="http://docbook.org/docbook-ng"
5 xmlns:db="http://docbook.org/ns/docbook"
6 xmlns:exsl="http://exslt.org/common"
8 exclude-result-prefixes="doc ng db exsl">
10 <xsl:import href="../html/chunk.xsl"/>
12 <xsl:output method="html"/>
14 <!-- ********************************************************************
15 $Id: javahelp.xsl 8400 2009-04-08 07:44:54Z bobstayton $
16 ********************************************************************
18 This file is part of the XSL DocBook Stylesheet distribution.
19 See ../README or http://docbook.sf.net/release/xsl/current/ for
20 copyright and other information.
22 ******************************************************************** -->
24 <!-- ==================================================================== -->
26 <xsl:template match="/">
27 <!-- * Get a title for current doc so that we let the user -->
28 <!-- * know what document we are processing at this point. -->
29 <xsl:variable name="doc.title">
30 <xsl:call-template name="get.doc.title"/>
33 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
34 toss the namespace and continue. Use the docbook5 namespaced
35 stylesheets for DocBook5 if you don't want to use this feature.-->
36 <xsl:when test="$exsl.node.set.available != 0
37 and (*/self::ng:* or */self::db:*)">
38 <xsl:call-template name="log.message">
39 <xsl:with-param name="level">Note</xsl:with-param>
40 <xsl:with-param name="source" select="$doc.title"/>
41 <xsl:with-param name="context-desc">
42 <xsl:text>namesp. cut</xsl:text>
44 <xsl:with-param name="message">
45 <xsl:text>stripped namespace before processing</xsl:text>
48 <xsl:variable name="nons">
49 <xsl:apply-templates mode="stripNS"/>
51 <xsl:call-template name="log.message">
52 <xsl:with-param name="level">Note</xsl:with-param>
53 <xsl:with-param name="source" select="$doc.title"/>
54 <xsl:with-param name="context-desc">
55 <xsl:text>namesp. cut</xsl:text>
57 <xsl:with-param name="message">
58 <xsl:text>processing stripped document</xsl:text>
61 <xsl:apply-templates select="exsl:node-set($nons)"/>
65 <xsl:when test="$rootid != ''">
67 <xsl:when test="count(key('id',$rootid)) = 0">
68 <xsl:message terminate="yes">
69 <xsl:text>ID '</xsl:text>
70 <xsl:value-of select="$rootid"/>
71 <xsl:text>' not found in document.</xsl:text>
75 <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
76 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
81 <xsl:apply-templates select="/" mode="process.root"/>
84 <xsl:for-each select="/"> <!-- This is just a hook for building profiling stylesheets -->
85 <xsl:call-template name="helpset"/>
86 <xsl:call-template name="helptoc"/>
87 <xsl:call-template name="helpmap"/>
88 <xsl:call-template name="helpidx"/>
94 <xsl:template name="header.navigation">
97 <xsl:template name="footer.navigation">
100 <!-- ==================================================================== -->
102 <xsl:template name="helpset">
103 <xsl:call-template name="write.chunk.with.doctype">
104 <xsl:with-param name="filename" select="concat($base.dir,'jhelpset.hs')"/>
105 <xsl:with-param name="method" select="'xml'"/>
106 <xsl:with-param name="indent" select="'yes'"/>
107 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN'"/>
108 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/helpset_1_0.dtd'"/>
109 <xsl:with-param name="content">
110 <xsl:call-template name="helpset.content"/>
112 <xsl:with-param name="quiet" select="$chunk.quietly"/>
116 <xsl:template name="helpset.content">
117 <xsl:variable name="title">
118 <xsl:apply-templates select="." mode="title.markup"/>
121 <helpset version="1.0">
123 <xsl:value-of select="normalize-space($title)"/>
129 <mapref location="jhelpmap.jhm"/>
135 <label>Table Of Contents</label>
136 <type>javax.help.TOCView</type>
137 <data>jhelptoc.xml</data>
143 <type>javax.help.IndexView</type>
144 <data>jhelpidx.xml</data>
149 <label>Search</label>
150 <type>javax.help.SearchView</type>
151 <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
156 <!-- ==================================================================== -->
158 <xsl:template name="helptoc">
159 <xsl:call-template name="write.chunk.with.doctype">
160 <xsl:with-param name="filename" select="concat($base.dir,'jhelptoc.xml')"/>
161 <xsl:with-param name="method" select="'xml'"/>
162 <xsl:with-param name="indent" select="'yes'"/>
163 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN'"/>
164 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/toc_1_0.dtd'"/>
165 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
166 <xsl:with-param name="content">
167 <xsl:call-template name="helptoc.content"/>
169 <xsl:with-param name="quiet" select="$chunk.quietly"/>
173 <xsl:template name="helptoc.content">
176 <xsl:when test="$rootid != ''">
177 <xsl:apply-templates select="key('id',$rootid)" mode="jhtoc"/>
180 <xsl:apply-templates select="." mode="jhtoc"/>
186 <xsl:template match="set" mode="jhtoc">
187 <xsl:variable name="id">
188 <xsl:call-template name="object.id">
189 <xsl:with-param name="object" select="."/>
192 <xsl:variable name="title">
193 <xsl:apply-templates select="." mode="title.markup"/>
196 <tocitem target="{$id}">
197 <xsl:attribute name="text">
198 <xsl:value-of select="normalize-space($title)"/>
200 <xsl:apply-templates select="book" mode="jhtoc"/>
204 <xsl:template match="book" mode="jhtoc">
205 <xsl:variable name="id">
206 <xsl:call-template name="object.id"/>
208 <xsl:variable name="title">
209 <xsl:apply-templates select="." mode="title.markup"/>
212 <tocitem target="{$id}">
213 <xsl:attribute name="text">
214 <xsl:value-of select="normalize-space($title)"/>
216 <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon|glossary|bibliography"
221 <xsl:template match="part|reference|preface|chapter|appendix|article"
223 <xsl:variable name="id">
224 <xsl:call-template name="object.id"/>
226 <xsl:variable name="title">
227 <xsl:apply-templates select="." mode="title.markup"/>
230 <tocitem target="{$id}">
231 <xsl:attribute name="text">
232 <xsl:value-of select="normalize-space($title)"/>
235 select="article|preface|chapter|appendix|refentry|section|sect1|glossary|bibliography"
240 <xsl:template match="section" mode="jhtoc">
241 <xsl:variable name="id">
242 <xsl:call-template name="object.id"/>
244 <xsl:variable name="title">
245 <xsl:apply-templates select="." mode="title.markup"/>
248 <tocitem target="{$id}">
249 <xsl:attribute name="text">
250 <xsl:value-of select="normalize-space($title)"/>
252 <xsl:apply-templates select="section" mode="jhtoc"/>
256 <xsl:template match="sect1" mode="jhtoc">
257 <xsl:variable name="id">
258 <xsl:call-template name="object.id"/>
260 <xsl:variable name="title">
261 <xsl:apply-templates select="." mode="title.markup"/>
264 <tocitem target="{$id}">
265 <xsl:attribute name="text">
266 <xsl:value-of select="normalize-space($title)"/>
268 <xsl:apply-templates select="sect2" mode="jhtoc"/>
272 <xsl:template match="sect2" mode="jhtoc">
273 <xsl:variable name="id">
274 <xsl:call-template name="object.id"/>
276 <xsl:variable name="title">
277 <xsl:apply-templates select="." mode="title.markup"/>
280 <tocitem target="{$id}">
281 <xsl:attribute name="text">
282 <xsl:value-of select="normalize-space($title)"/>
284 <xsl:apply-templates select="sect3" mode="jhtoc"/>
288 <xsl:template match="sect3" mode="jhtoc">
289 <xsl:variable name="id">
290 <xsl:call-template name="object.id"/>
292 <xsl:variable name="title">
293 <xsl:apply-templates select="." mode="title.markup"/>
296 <tocitem target="{$id}">
297 <xsl:attribute name="text">
298 <xsl:value-of select="normalize-space($title)"/>
300 <xsl:apply-templates select="sect4" mode="jhtoc"/>
304 <xsl:template match="sect4" mode="jhtoc">
305 <xsl:variable name="id">
306 <xsl:call-template name="object.id"/>
308 <xsl:variable name="title">
309 <xsl:apply-templates select="." mode="title.markup"/>
312 <tocitem target="{$id}">
313 <xsl:attribute name="text">
314 <xsl:value-of select="normalize-space($title)"/>
316 <xsl:apply-templates select="sect5" mode="jhtoc"/>
320 <xsl:template match="sect5|colophon|refentry" mode="jhtoc">
321 <xsl:variable name="id">
322 <xsl:call-template name="object.id"/>
324 <xsl:variable name="title">
325 <xsl:apply-templates select="." mode="title.markup"/>
328 <tocitem target="{$id}">
329 <xsl:attribute name="text">
330 <xsl:value-of select="normalize-space($title)"/>
336 <xsl:template match="glossary" mode="jhtoc">
337 <xsl:variable name="id">
338 <xsl:call-template name="object.id"/>
341 <xsl:variable name="title">
342 <xsl:call-template name="gentext">
343 <xsl:with-param name="key" select="'Glossary'"/>
347 <tocitem target="{$id}">
348 <xsl:attribute name="text">
349 <xsl:value-of select="$title"/>
355 <xsl:template match="bibliography" mode="jhtoc">
356 <xsl:variable name="id">
357 <xsl:call-template name="object.id"/>
360 <xsl:variable name="title">
361 <xsl:call-template name="gentext">
362 <xsl:with-param name="key" select="'Bibliography'"/>
366 <tocitem target="{$id}">
367 <xsl:attribute name="text">
368 <xsl:value-of select="$title"/>
374 <!-- ==================================================================== -->
376 <xsl:template name="helpmap">
377 <xsl:call-template name="write.chunk.with.doctype">
378 <xsl:with-param name="filename" select="concat($base.dir, 'jhelpmap.jhm')"/>
379 <xsl:with-param name="method" select="'xml'"/>
380 <xsl:with-param name="indent" select="'yes'"/>
381 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN'"/>
382 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/map_1_0.dtd'"/>
383 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
384 <xsl:with-param name="content">
385 <xsl:call-template name="helpmap.content"/>
387 <xsl:with-param name="quiet" select="$chunk.quietly"/>
391 <xsl:template name="helpmap.content">
394 <xsl:when test="$rootid != ''">
395 <xsl:apply-templates select="key('id',$rootid)//set
396 | key('id',$rootid)//book
397 | key('id',$rootid)//part
398 | key('id',$rootid)//reference
399 | key('id',$rootid)//preface
400 | key('id',$rootid)//chapter
401 | key('id',$rootid)//appendix
402 | key('id',$rootid)//article
403 | key('id',$rootid)//colophon
404 | key('id',$rootid)//refentry
405 | key('id',$rootid)//section
406 | key('id',$rootid)//sect1
407 | key('id',$rootid)//sect2
408 | key('id',$rootid)//sect3
409 | key('id',$rootid)//sect4
410 | key('id',$rootid)//sect5
411 | key('id',$rootid)//indexterm
412 | key('id',$rootid)//glossary
413 | key('id',$rootid)//bibliography
414 | key('id',$rootid)//*[@id]"
418 <xsl:apply-templates select="//set
444 <xsl:template match="set" mode="map">
445 <xsl:variable name="id">
446 <xsl:call-template name="object.id">
447 <xsl:with-param name="object" select="."/>
451 <mapID target="{$id}">
452 <xsl:attribute name="url">
453 <xsl:call-template name="href.target.uri"/>
458 <xsl:template match="book" mode="map">
459 <xsl:variable name="id">
460 <xsl:call-template name="object.id"/>
463 <mapID target="{$id}">
464 <xsl:attribute name="url">
465 <xsl:call-template name="href.target.uri"/>
470 <xsl:template match="part|reference|preface|chapter|appendix|refentry|article|glossary|bibliography"
472 <xsl:variable name="id">
473 <xsl:call-template name="object.id"/>
476 <mapID target="{$id}">
477 <xsl:attribute name="url">
478 <xsl:call-template name="href.target.uri"/>
483 <xsl:template match="section|sect1|sect2|sect3|sect4|sect5|colophon" mode="map">
484 <xsl:variable name="id">
485 <xsl:call-template name="object.id"/>
488 <mapID target="{$id}">
489 <xsl:attribute name="url">
490 <xsl:call-template name="href.target.uri"/>
495 <xsl:template match="indexterm[@class='endofrange']" mode="map"/>
497 <xsl:template match="indexterm" mode="map">
498 <xsl:variable name="id">
499 <xsl:call-template name="object.id"/>
502 <mapID target="{$id}">
503 <xsl:attribute name="url">
504 <xsl:call-template name="href.target.uri"/>
509 <xsl:template match="*[@id]" mode="map">
510 <xsl:variable name="id">
511 <xsl:call-template name="object.id"/>
514 <mapID target="{$id}">
515 <xsl:attribute name="url">
516 <xsl:call-template name="href.target.uri"/>
521 <!-- ==================================================================== -->
523 <xsl:template name="helpidx">
524 <xsl:call-template name="write.chunk.with.doctype">
525 <xsl:with-param name="filename" select="concat($base.dir, 'jhelpidx.xml')"/>
526 <xsl:with-param name="method" select="'xml'"/>
527 <xsl:with-param name="indent" select="'yes'"/>
528 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN'"/>
529 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/index_1_0.dtd'"/>
530 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
531 <xsl:with-param name="content">
532 <xsl:call-template name="helpidx.content"/>
534 <xsl:with-param name="quiet" select="$chunk.quietly"/>
538 <xsl:template name="helpidx.content">
539 <index version="1.0">
541 <xsl:when test="$rootid != ''">
542 <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
543 <xsl:sort select="primary"/>
544 <xsl:sort select="secondary"/>
545 <xsl:sort select="tertiary"/>
546 </xsl:apply-templates>
549 <xsl:apply-templates select="//indexterm" mode="idx">
550 <xsl:sort select="primary"/>
551 <xsl:sort select="secondary"/>
552 <xsl:sort select="tertiary"/>
553 </xsl:apply-templates>
559 <xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
561 <xsl:template match="indexterm" mode="idx">
562 <xsl:variable name="id">
563 <xsl:call-template name="object.id"/>
566 <xsl:variable name="text">
567 <xsl:value-of select="normalize-space(primary)"/>
568 <xsl:if test="secondary">
569 <xsl:text>, </xsl:text>
570 <xsl:value-of select="normalize-space(secondary)"/>
572 <xsl:if test="tertiary">
573 <xsl:text>, </xsl:text>
574 <xsl:value-of select="normalize-space(tertiary)"/>
579 <xsl:when test="see">
580 <xsl:variable name="see"><xsl:value-of select="normalize-space(see)"/></xsl:variable>
581 <indexitem text="{$text} see '{$see}'"/>
584 <indexitem text="{$text}" target="{$id}"/>
589 <!-- ==================================================================== -->
590 <!-- Kludge for Xalan outputting ™ which fails in javahelp -->
591 <xsl:template name="dingbat.characters">
592 <!-- now that I'm using the real serializer, all that dingbat malarky -->
593 <!-- isn't necessary anymore... -->
594 <xsl:param name="dingbat">bullet</xsl:param>
597 <xsl:when test="$dingbat='bullet'">•</xsl:when>
598 <xsl:when test="$dingbat='copyright'">©</xsl:when>
599 <xsl:when test="$dingbat='trademark' or $dingbat='trade'">
601 <xsl:when test="contains(system-property('xsl:vendor'),
602 'Apache Software Foundation')">
605 <xsl:otherwise>™</xsl:otherwise>
608 <xsl:when test="$dingbat='registered'">®</xsl:when>
609 <xsl:when test="$dingbat='service'">(SM)</xsl:when>
610 <xsl:when test="$dingbat='nbsp'"> </xsl:when>
611 <xsl:when test="$dingbat='ldquo'">“</xsl:when>
612 <xsl:when test="$dingbat='rdquo'">”</xsl:when>
613 <xsl:when test="$dingbat='lsquo'">‘</xsl:when>
614 <xsl:when test="$dingbat='rsquo'">’</xsl:when>
615 <xsl:when test="$dingbat='em-dash'">—</xsl:when>
616 <xsl:when test="$dingbat='mdash'">—</xsl:when>
617 <xsl:when test="$dingbat='en-dash'">–</xsl:when>
618 <xsl:when test="$dingbat='ndash'">–</xsl:when>
620 <xsl:text>•</xsl:text>