source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/javahelp/javahelp.xsl@ 1fa2099

multilib-10.1
Last change on this file since 1fa2099 was 1fa2099, checked in by Thomas Trepl <thomas@…>, 5 years ago

Initial creation of multilib branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11565 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 20.7 KB
Line 
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:ng="http://docbook.org/docbook-ng"
5 xmlns:db="http://docbook.org/ns/docbook"
6 xmlns:exsl="http://exslt.org/common"
7 version="1.0"
8 exclude-result-prefixes="doc ng db exsl">
9
10<xsl:import href="../html/chunk.xsl"/>
11
12<xsl:output method="html"/>
13
14<!-- ********************************************************************
15 $Id: javahelp.xsl 9152 2011-11-12 00:17:33Z bobstayton $
16 ********************************************************************
17
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.
21
22 ******************************************************************** -->
23
24<!-- ==================================================================== -->
25
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"/>
31 </xsl:variable>
32 <xsl:choose>
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>
43 </xsl:with-param>
44 <xsl:with-param name="message">
45 <xsl:text>stripped namespace before processing</xsl:text>
46 </xsl:with-param>
47 </xsl:call-template>
48 <xsl:variable name="nons">
49 <xsl:apply-templates mode="stripNS"/>
50 </xsl:variable>
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>
56 </xsl:with-param>
57 <xsl:with-param name="message">
58 <xsl:text>processing stripped document</xsl:text>
59 </xsl:with-param>
60 </xsl:call-template>
61 <xsl:apply-templates select="exsl:node-set($nons)"/>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:choose>
65 <xsl:when test="$rootid != ''">
66 <xsl:choose>
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>
72 </xsl:message>
73 </xsl:when>
74 <xsl:otherwise>
75 <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
76 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:apply-templates select="/" mode="process.root"/>
82 </xsl:otherwise>
83 </xsl:choose>
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"/>
89 </xsl:for-each>
90</xsl:otherwise>
91</xsl:choose>
92</xsl:template>
93
94<xsl:param name="suppress.navigation" select="1"/>
95
96<!-- ==================================================================== -->
97
98<xsl:template name="helpset">
99 <xsl:call-template name="write.chunk.with.doctype">
100 <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelpset.hs')"/>
101 <xsl:with-param name="method" select="'xml'"/>
102 <xsl:with-param name="indent" select="'yes'"/>
103 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN'"/>
104 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/helpset_1_0.dtd'"/>
105 <xsl:with-param name="content">
106 <xsl:call-template name="helpset.content"/>
107 </xsl:with-param>
108 <xsl:with-param name="quiet" select="$chunk.quietly"/>
109 </xsl:call-template>
110</xsl:template>
111
112<xsl:template name="helpset.content">
113 <xsl:variable name="title">
114 <xsl:apply-templates select="." mode="title.markup"/>
115 </xsl:variable>
116
117 <helpset version="1.0">
118 <title>
119 <xsl:value-of select="normalize-space($title)"/>
120 </title>
121
122 <!-- maps -->
123 <maps>
124 <homeID>top</homeID>
125 <mapref location="jhelpmap.jhm"/>
126 </maps>
127
128 <!-- views -->
129 <view>
130 <name>TOC</name>
131 <label>Table Of Contents</label>
132 <type>javax.help.TOCView</type>
133 <data>jhelptoc.xml</data>
134 </view>
135
136 <view>
137 <name>Index</name>
138 <label>Index</label>
139 <type>javax.help.IndexView</type>
140 <data>jhelpidx.xml</data>
141 </view>
142
143 <view>
144 <name>Search</name>
145 <label>Search</label>
146 <type>javax.help.SearchView</type>
147 <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
148 </view>
149 </helpset>
150</xsl:template>
151
152<!-- ==================================================================== -->
153
154<xsl:template name="helptoc">
155 <xsl:call-template name="write.chunk.with.doctype">
156 <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelptoc.xml')"/>
157 <xsl:with-param name="method" select="'xml'"/>
158 <xsl:with-param name="indent" select="'yes'"/>
159 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN'"/>
160 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/toc_1_0.dtd'"/>
161 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
162 <xsl:with-param name="content">
163 <xsl:call-template name="helptoc.content"/>
164 </xsl:with-param>
165 <xsl:with-param name="quiet" select="$chunk.quietly"/>
166 </xsl:call-template>
167</xsl:template>
168
169<xsl:template name="helptoc.content">
170 <toc version="1.0">
171 <xsl:choose>
172 <xsl:when test="$rootid != ''">
173 <xsl:apply-templates select="key('id',$rootid)" mode="jhtoc"/>
174 </xsl:when>
175 <xsl:otherwise>
176 <xsl:apply-templates select="." mode="jhtoc"/>
177 </xsl:otherwise>
178 </xsl:choose>
179 </toc>
180</xsl:template>
181
182<xsl:template match="set" mode="jhtoc">
183 <xsl:variable name="id">
184 <xsl:call-template name="object.id">
185 <xsl:with-param name="object" select="."/>
186 </xsl:call-template>
187 </xsl:variable>
188 <xsl:variable name="title">
189 <xsl:apply-templates select="." mode="title.markup"/>
190 </xsl:variable>
191
192 <tocitem target="{$id}">
193 <xsl:attribute name="text">
194 <xsl:value-of select="normalize-space($title)"/>
195 </xsl:attribute>
196 <xsl:apply-templates select="book" mode="jhtoc"/>
197 </tocitem>
198</xsl:template>
199
200<xsl:template match="book" mode="jhtoc">
201 <xsl:variable name="id">
202 <xsl:call-template name="object.id"/>
203 </xsl:variable>
204 <xsl:variable name="title">
205 <xsl:apply-templates select="." mode="title.markup"/>
206 </xsl:variable>
207
208 <tocitem target="{$id}">
209 <xsl:attribute name="text">
210 <xsl:value-of select="normalize-space($title)"/>
211 </xsl:attribute>
212 <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon|glossary|bibliography"
213 mode="jhtoc"/>
214 </tocitem>
215</xsl:template>
216
217<xsl:template match="part|reference|preface|chapter|appendix|article"
218 mode="jhtoc">
219 <xsl:variable name="id">
220 <xsl:call-template name="object.id"/>
221 </xsl:variable>
222 <xsl:variable name="title">
223 <xsl:apply-templates select="." mode="title.markup"/>
224 </xsl:variable>
225
226 <tocitem target="{$id}">
227 <xsl:attribute name="text">
228 <xsl:value-of select="normalize-space($title)"/>
229 </xsl:attribute>
230 <xsl:apply-templates
231 select="article|preface|chapter|appendix|refentry|section|sect1|glossary|bibliography"
232 mode="jhtoc"/>
233 </tocitem>
234</xsl:template>
235
236<xsl:template match="section" mode="jhtoc">
237 <xsl:variable name="id">
238 <xsl:call-template name="object.id"/>
239 </xsl:variable>
240 <xsl:variable name="title">
241 <xsl:apply-templates select="." mode="title.markup"/>
242 </xsl:variable>
243
244 <tocitem target="{$id}">
245 <xsl:attribute name="text">
246 <xsl:value-of select="normalize-space($title)"/>
247 </xsl:attribute>
248 <xsl:apply-templates select="section" mode="jhtoc"/>
249 </tocitem>
250</xsl:template>
251
252<xsl:template match="sect1" mode="jhtoc">
253 <xsl:variable name="id">
254 <xsl:call-template name="object.id"/>
255 </xsl:variable>
256 <xsl:variable name="title">
257 <xsl:apply-templates select="." mode="title.markup"/>
258 </xsl:variable>
259
260 <tocitem target="{$id}">
261 <xsl:attribute name="text">
262 <xsl:value-of select="normalize-space($title)"/>
263 </xsl:attribute>
264 <xsl:apply-templates select="sect2" mode="jhtoc"/>
265 </tocitem>
266</xsl:template>
267
268<xsl:template match="sect2" mode="jhtoc">
269 <xsl:variable name="id">
270 <xsl:call-template name="object.id"/>
271 </xsl:variable>
272 <xsl:variable name="title">
273 <xsl:apply-templates select="." mode="title.markup"/>
274 </xsl:variable>
275
276 <tocitem target="{$id}">
277 <xsl:attribute name="text">
278 <xsl:value-of select="normalize-space($title)"/>
279 </xsl:attribute>
280 <xsl:apply-templates select="sect3" mode="jhtoc"/>
281 </tocitem>
282</xsl:template>
283
284<xsl:template match="sect3" mode="jhtoc">
285 <xsl:variable name="id">
286 <xsl:call-template name="object.id"/>
287 </xsl:variable>
288 <xsl:variable name="title">
289 <xsl:apply-templates select="." mode="title.markup"/>
290 </xsl:variable>
291
292 <tocitem target="{$id}">
293 <xsl:attribute name="text">
294 <xsl:value-of select="normalize-space($title)"/>
295 </xsl:attribute>
296 <xsl:apply-templates select="sect4" mode="jhtoc"/>
297 </tocitem>
298</xsl:template>
299
300<xsl:template match="sect4" mode="jhtoc">
301 <xsl:variable name="id">
302 <xsl:call-template name="object.id"/>
303 </xsl:variable>
304 <xsl:variable name="title">
305 <xsl:apply-templates select="." mode="title.markup"/>
306 </xsl:variable>
307
308 <tocitem target="{$id}">
309 <xsl:attribute name="text">
310 <xsl:value-of select="normalize-space($title)"/>
311 </xsl:attribute>
312 <xsl:apply-templates select="sect5" mode="jhtoc"/>
313 </tocitem>
314</xsl:template>
315
316<xsl:template match="sect5|colophon|refentry" mode="jhtoc">
317 <xsl:variable name="id">
318 <xsl:call-template name="object.id"/>
319 </xsl:variable>
320 <xsl:variable name="title">
321 <xsl:apply-templates select="." mode="title.markup"/>
322 </xsl:variable>
323
324 <tocitem target="{$id}">
325 <xsl:attribute name="text">
326 <xsl:value-of select="normalize-space($title)"/>
327 </xsl:attribute>
328 </tocitem>
329</xsl:template>
330
331
332<xsl:template match="glossary" mode="jhtoc">
333 <xsl:variable name="id">
334 <xsl:call-template name="object.id"/>
335 </xsl:variable>
336
337 <xsl:variable name="title">
338 <xsl:call-template name="gentext">
339 <xsl:with-param name="key" select="'Glossary'"/>
340 </xsl:call-template>
341 </xsl:variable>
342
343 <tocitem target="{$id}">
344 <xsl:attribute name="text">
345 <xsl:value-of select="$title"/>
346 </xsl:attribute>
347 </tocitem>
348
349</xsl:template>
350
351<xsl:template match="bibliography" mode="jhtoc">
352 <xsl:variable name="id">
353 <xsl:call-template name="object.id"/>
354 </xsl:variable>
355
356 <xsl:variable name="title">
357 <xsl:call-template name="gentext">
358 <xsl:with-param name="key" select="'Bibliography'"/>
359 </xsl:call-template>
360 </xsl:variable>
361
362 <tocitem target="{$id}">
363 <xsl:attribute name="text">
364 <xsl:value-of select="$title"/>
365 </xsl:attribute>
366
367 </tocitem>
368</xsl:template>
369
370<!-- ==================================================================== -->
371
372<xsl:template name="helpmap">
373 <xsl:call-template name="write.chunk.with.doctype">
374 <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpmap.jhm')"/>
375 <xsl:with-param name="method" select="'xml'"/>
376 <xsl:with-param name="indent" select="'yes'"/>
377 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN'"/>
378 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/map_1_0.dtd'"/>
379 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
380 <xsl:with-param name="content">
381 <xsl:call-template name="helpmap.content"/>
382 </xsl:with-param>
383 <xsl:with-param name="quiet" select="$chunk.quietly"/>
384 </xsl:call-template>
385</xsl:template>
386
387<xsl:template name="helpmap.content">
388 <map version="1.0">
389 <xsl:choose>
390 <xsl:when test="$rootid != ''">
391 <xsl:apply-templates select="key('id',$rootid)//set
392 | key('id',$rootid)//book
393 | key('id',$rootid)//part
394 | key('id',$rootid)//reference
395 | key('id',$rootid)//preface
396 | key('id',$rootid)//chapter
397 | key('id',$rootid)//appendix
398 | key('id',$rootid)//article
399 | key('id',$rootid)//colophon
400 | key('id',$rootid)//refentry
401 | key('id',$rootid)//section
402 | key('id',$rootid)//sect1
403 | key('id',$rootid)//sect2
404 | key('id',$rootid)//sect3
405 | key('id',$rootid)//sect4
406 | key('id',$rootid)//sect5
407 | key('id',$rootid)//indexterm
408 | key('id',$rootid)//glossary
409 | key('id',$rootid)//bibliography
410 | key('id',$rootid)//*[@id]"
411 mode="map"/>
412 </xsl:when>
413 <xsl:otherwise>
414 <xsl:apply-templates select="//set
415 | //book
416 | //part
417 | //reference
418 | //preface
419 | //chapter
420 | //appendix
421 | //article
422 | //colophon
423 | //refentry
424 | //section
425 | //sect1
426 | //sect2
427 | //sect3
428 | //sect4
429 | //sect5
430 | //indexterm
431 | //glossary
432 | //bibliography
433 | //*[@id]"
434 mode="map"/>
435 </xsl:otherwise>
436 </xsl:choose>
437 </map>
438</xsl:template>
439
440<xsl:template match="set" mode="map">
441 <xsl:variable name="id">
442 <xsl:call-template name="object.id">
443 <xsl:with-param name="object" select="."/>
444 </xsl:call-template>
445 </xsl:variable>
446
447 <mapID target="{$id}">
448 <xsl:attribute name="url">
449 <xsl:call-template name="href.target.uri"/>
450 </xsl:attribute>
451 </mapID>
452</xsl:template>
453
454<xsl:template match="book" mode="map">
455 <xsl:variable name="id">
456 <xsl:call-template name="object.id"/>
457 </xsl:variable>
458
459 <mapID target="{$id}">
460 <xsl:attribute name="url">
461 <xsl:call-template name="href.target.uri"/>
462 </xsl:attribute>
463 </mapID>
464</xsl:template>
465
466<xsl:template match="part|reference|preface|chapter|appendix|refentry|article|glossary|bibliography"
467 mode="map">
468 <xsl:variable name="id">
469 <xsl:call-template name="object.id"/>
470 </xsl:variable>
471
472 <mapID target="{$id}">
473 <xsl:attribute name="url">
474 <xsl:call-template name="href.target.uri"/>
475 </xsl:attribute>
476 </mapID>
477</xsl:template>
478
479<xsl:template match="section|sect1|sect2|sect3|sect4|sect5|colophon" mode="map">
480 <xsl:variable name="id">
481 <xsl:call-template name="object.id"/>
482 </xsl:variable>
483
484 <mapID target="{$id}">
485 <xsl:attribute name="url">
486 <xsl:call-template name="href.target.uri"/>
487 </xsl:attribute>
488 </mapID>
489</xsl:template>
490
491<xsl:template match="indexterm[@class='endofrange']" mode="map"/>
492
493<xsl:template match="indexterm" mode="map">
494 <xsl:variable name="id">
495 <xsl:call-template name="object.id"/>
496 </xsl:variable>
497
498 <mapID target="{$id}">
499 <xsl:attribute name="url">
500 <xsl:call-template name="href.target.uri"/>
501 </xsl:attribute>
502 </mapID>
503</xsl:template>
504
505<xsl:template match="*[@id]" mode="map">
506 <xsl:variable name="id">
507 <xsl:call-template name="object.id"/>
508 </xsl:variable>
509
510 <mapID target="{$id}">
511 <xsl:attribute name="url">
512 <xsl:call-template name="href.target.uri"/>
513 </xsl:attribute>
514 </mapID>
515</xsl:template>
516
517<!-- ==================================================================== -->
518
519<xsl:template name="helpidx">
520 <xsl:call-template name="write.chunk.with.doctype">
521 <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpidx.xml')"/>
522 <xsl:with-param name="method" select="'xml'"/>
523 <xsl:with-param name="indent" select="'yes'"/>
524 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN'"/>
525 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/index_1_0.dtd'"/>
526 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
527 <xsl:with-param name="content">
528 <xsl:call-template name="helpidx.content"/>
529 </xsl:with-param>
530 <xsl:with-param name="quiet" select="$chunk.quietly"/>
531 </xsl:call-template>
532</xsl:template>
533
534<xsl:template name="helpidx.content">
535 <index version="1.0">
536 <xsl:choose>
537 <xsl:when test="$rootid != ''">
538 <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
539 <xsl:sort select="primary"/>
540 <xsl:sort select="secondary"/>
541 <xsl:sort select="tertiary"/>
542 </xsl:apply-templates>
543 </xsl:when>
544 <xsl:otherwise>
545 <xsl:apply-templates select="//indexterm" mode="idx">
546 <xsl:sort select="primary"/>
547 <xsl:sort select="secondary"/>
548 <xsl:sort select="tertiary"/>
549 </xsl:apply-templates>
550 </xsl:otherwise>
551 </xsl:choose>
552 </index>
553</xsl:template>
554
555<xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
556
557<xsl:template match="indexterm" mode="idx">
558 <xsl:variable name="id">
559 <xsl:call-template name="object.id"/>
560 </xsl:variable>
561
562 <xsl:variable name="text">
563 <xsl:value-of select="normalize-space(primary)"/>
564 <xsl:if test="secondary">
565 <xsl:text>, </xsl:text>
566 <xsl:value-of select="normalize-space(secondary)"/>
567 </xsl:if>
568 <xsl:if test="tertiary">
569 <xsl:text>, </xsl:text>
570 <xsl:value-of select="normalize-space(tertiary)"/>
571 </xsl:if>
572 </xsl:variable>
573
574 <xsl:choose>
575 <xsl:when test="see">
576 <xsl:variable name="see"><xsl:value-of select="normalize-space(see)"/></xsl:variable>
577 <indexitem text="{$text} see '{$see}'"/>
578 </xsl:when>
579 <xsl:otherwise>
580 <indexitem text="{$text}" target="{$id}"/>
581 </xsl:otherwise>
582 </xsl:choose>
583</xsl:template>
584
585<!-- ==================================================================== -->
586<!-- Kludge for Xalan outputting &trade; which fails in javahelp -->
587<xsl:template name="dingbat.characters">
588 <!-- now that I'm using the real serializer, all that dingbat malarky -->
589 <!-- isn't necessary anymore... -->
590 <xsl:param name="dingbat">bullet</xsl:param>
591
592 <xsl:choose>
593 <xsl:when test="$dingbat='bullet'">&#x2022;</xsl:when>
594 <xsl:when test="$dingbat='copyright'">&#x00A9;</xsl:when>
595 <xsl:when test="$dingbat='trademark' or $dingbat='trade'">
596 <xsl:choose>
597 <xsl:when test="contains(system-property('xsl:vendor'),
598 'Apache Software Foundation')">
599 <sup>TM</sup>
600 </xsl:when>
601 <xsl:otherwise>&#x2122;</xsl:otherwise>
602 </xsl:choose>
603 </xsl:when>
604 <xsl:when test="$dingbat='registered'">&#x00AE;</xsl:when>
605 <xsl:when test="$dingbat='service'">(SM)</xsl:when>
606 <xsl:when test="$dingbat='nbsp'">&#x00A0;</xsl:when>
607 <xsl:when test="$dingbat='ldquo'">&#x201C;</xsl:when>
608 <xsl:when test="$dingbat='rdquo'">&#x201D;</xsl:when>
609 <xsl:when test="$dingbat='lsquo'">&#x2018;</xsl:when>
610 <xsl:when test="$dingbat='rsquo'">&#x2019;</xsl:when>
611 <xsl:when test="$dingbat='em-dash'">&#x2014;</xsl:when>
612 <xsl:when test="$dingbat='mdash'">&#x2014;</xsl:when>
613 <xsl:when test="$dingbat='en-dash'">&#x2013;</xsl:when>
614 <xsl:when test="$dingbat='ndash'">&#x2013;</xsl:when>
615 <xsl:otherwise>
616 <xsl:text>&#x2022;</xsl:text>
617 </xsl:otherwise>
618 </xsl:choose>
619</xsl:template>
620
621</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.