source: trunk/Distribution/XSL/javahelp/javahelp.xsl@ 3

Last change on this file since 3 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 16.9 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 version="1.0"
5 exclude-result-prefixes="doc">
6
7<xsl:import href="../html/chunk.xsl"/>
8
9<xsl:output method="html"/>
10
11<!-- ********************************************************************
12 $Id: javahelp.xsl,v 1.9 2004/10/22 08:29:12 bobstayton Exp $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
17 and other information.
18
19 ******************************************************************** -->
20
21<!-- ==================================================================== -->
22<xsl:param name="javahelp.encoding" select="'ISO-8859-1'"/>
23
24<doc:param name="javahelp.encoding" xmlns="">
25<refpurpose>Character encoding to use in control files for Java Help.</refpurpose>
26<refdescription>
27<para>Java Help crashes on some characters when written as character
28references. In that case you can select appropriate encoding here.</para>
29</refdescription>
30</doc:param>
31
32<!-- ==================================================================== -->
33
34<xsl:template match="/">
35 <xsl:choose>
36 <xsl:when test="$rootid != ''">
37 <xsl:choose>
38 <xsl:when test="count(key('id',$rootid)) = 0">
39 <xsl:message terminate="yes">
40 <xsl:text>ID '</xsl:text>
41 <xsl:value-of select="$rootid"/>
42 <xsl:text>' not found in document.</xsl:text>
43 </xsl:message>
44 </xsl:when>
45 <xsl:otherwise>
46 <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
47 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
48 </xsl:otherwise>
49 </xsl:choose>
50 </xsl:when>
51 <xsl:otherwise>
52 <xsl:apply-templates select="/" mode="process.root"/>
53 </xsl:otherwise>
54 </xsl:choose>
55
56 <xsl:call-template name="helpset"/>
57 <xsl:call-template name="helptoc"/>
58 <xsl:call-template name="helpmap"/>
59 <xsl:call-template name="helpidx"/>
60</xsl:template>
61
62
63<xsl:template name="header.navigation">
64</xsl:template>
65
66<xsl:template name="footer.navigation">
67</xsl:template>
68
69<!-- ==================================================================== -->
70
71<xsl:template name="helpset">
72 <xsl:call-template name="write.chunk.with.doctype">
73 <xsl:with-param name="filename" select="concat($base.dir,'jhelpset.hs')"/>
74 <xsl:with-param name="method" select="'xml'"/>
75 <xsl:with-param name="indent" select="'yes'"/>
76 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN'"/>
77 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/helpset_1_0.dtd'"/>
78 <xsl:with-param name="content">
79 <xsl:call-template name="helpset.content"/>
80 </xsl:with-param>
81 </xsl:call-template>
82</xsl:template>
83
84<xsl:template name="helpset.content">
85 <xsl:variable name="title">
86 <xsl:apply-templates select="." mode="title.markup"/>
87 </xsl:variable>
88
89 <helpset version="1.0">
90 <title>
91 <xsl:value-of select="$title"/>
92 </title>
93
94 <!-- maps -->
95 <maps>
96 <homeID>top</homeID>
97 <mapref location="jhelpmap.jhm"/>
98 </maps>
99
100 <!-- views -->
101 <view>
102 <name>TOC</name>
103 <label>Table Of Contents</label>
104 <type>javax.help.TOCView</type>
105 <data>jhelptoc.xml</data>
106 </view>
107
108 <view>
109 <name>Index</name>
110 <label>Index</label>
111 <type>javax.help.IndexView</type>
112 <data>jhelpidx.xml</data>
113 </view>
114
115 <view>
116 <name>Search</name>
117 <label>Search</label>
118 <type>javax.help.SearchView</type>
119 <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
120 </view>
121 </helpset>
122</xsl:template>
123
124<!-- ==================================================================== -->
125
126<xsl:template name="helptoc">
127 <xsl:call-template name="write.chunk.with.doctype">
128 <xsl:with-param name="filename" select="concat($base.dir,'jhelptoc.xml')"/>
129 <xsl:with-param name="method" select="'xml'"/>
130 <xsl:with-param name="indent" select="'yes'"/>
131 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN'"/>
132 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/toc_1_0.dtd'"/>
133 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
134 <xsl:with-param name="content">
135 <xsl:call-template name="helptoc.content"/>
136 </xsl:with-param>
137 </xsl:call-template>
138</xsl:template>
139
140<xsl:template name="helptoc.content">
141 <toc version="1.0">
142 <xsl:choose>
143 <xsl:when test="$rootid != ''">
144 <xsl:apply-templates select="key('id',$rootid)" mode="jhtoc"/>
145 </xsl:when>
146 <xsl:otherwise>
147 <xsl:apply-templates select="." mode="jhtoc"/>
148 </xsl:otherwise>
149 </xsl:choose>
150 </toc>
151</xsl:template>
152
153<xsl:template match="set" mode="jhtoc">
154 <xsl:variable name="id">
155 <xsl:call-template name="object.id">
156 <xsl:with-param name="object" select="."/>
157 </xsl:call-template>
158 </xsl:variable>
159 <xsl:variable name="title">
160 <xsl:apply-templates select="." mode="title.markup"/>
161 </xsl:variable>
162
163 <tocitem target="{$id}">
164 <xsl:attribute name="text">
165 <xsl:value-of select="$title"/>
166 </xsl:attribute>
167 <xsl:apply-templates select="book" mode="jhtoc"/>
168 </tocitem>
169</xsl:template>
170
171<xsl:template match="book" mode="jhtoc">
172 <xsl:variable name="id">
173 <xsl:call-template name="object.id"/>
174 </xsl:variable>
175 <xsl:variable name="title">
176 <xsl:apply-templates select="." mode="title.markup"/>
177 </xsl:variable>
178
179 <tocitem target="{$id}">
180 <xsl:attribute name="text">
181 <xsl:value-of select="$title"/>
182 </xsl:attribute>
183 <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon"
184 mode="jhtoc"/>
185 </tocitem>
186</xsl:template>
187
188<xsl:template match="part|reference|preface|chapter|appendix|article"
189 mode="jhtoc">
190 <xsl:variable name="id">
191 <xsl:call-template name="object.id"/>
192 </xsl:variable>
193 <xsl:variable name="title">
194 <xsl:apply-templates select="." mode="title.markup"/>
195 </xsl:variable>
196
197 <tocitem target="{$id}">
198 <xsl:attribute name="text">
199 <xsl:value-of select="$title"/>
200 </xsl:attribute>
201 <xsl:apply-templates
202 select="preface|chapter|appendix|refentry|section|sect1"
203 mode="jhtoc"/>
204 </tocitem>
205</xsl:template>
206
207<xsl:template match="section" mode="jhtoc">
208 <xsl:variable name="id">
209 <xsl:call-template name="object.id"/>
210 </xsl:variable>
211 <xsl:variable name="title">
212 <xsl:apply-templates select="." mode="title.markup"/>
213 </xsl:variable>
214
215 <tocitem target="{$id}">
216 <xsl:attribute name="text">
217 <xsl:value-of select="$title"/>
218 </xsl:attribute>
219 <xsl:apply-templates select="section" mode="jhtoc"/>
220 </tocitem>
221</xsl:template>
222
223<xsl:template match="sect1" mode="jhtoc">
224 <xsl:variable name="id">
225 <xsl:call-template name="object.id"/>
226 </xsl:variable>
227 <xsl:variable name="title">
228 <xsl:apply-templates select="." mode="title.markup"/>
229 </xsl:variable>
230
231 <tocitem target="{$id}">
232 <xsl:attribute name="text">
233 <xsl:value-of select="$title"/>
234 </xsl:attribute>
235 <xsl:apply-templates select="sect2" mode="jhtoc"/>
236 </tocitem>
237</xsl:template>
238
239<xsl:template match="sect2" mode="jhtoc">
240 <xsl:variable name="id">
241 <xsl:call-template name="object.id"/>
242 </xsl:variable>
243 <xsl:variable name="title">
244 <xsl:apply-templates select="." mode="title.markup"/>
245 </xsl:variable>
246
247 <tocitem target="{$id}">
248 <xsl:attribute name="text">
249 <xsl:value-of select="$title"/>
250 </xsl:attribute>
251 <xsl:apply-templates select="sect3" mode="jhtoc"/>
252 </tocitem>
253</xsl:template>
254
255<xsl:template match="sect3" mode="jhtoc">
256 <xsl:variable name="id">
257 <xsl:call-template name="object.id"/>
258 </xsl:variable>
259 <xsl:variable name="title">
260 <xsl:apply-templates select="." mode="title.markup"/>
261 </xsl:variable>
262
263 <tocitem target="{$id}">
264 <xsl:attribute name="text">
265 <xsl:value-of select="$title"/>
266 </xsl:attribute>
267 <xsl:apply-templates select="sect4" mode="jhtoc"/>
268 </tocitem>
269</xsl:template>
270
271<xsl:template match="sect4" mode="jhtoc">
272 <xsl:variable name="id">
273 <xsl:call-template name="object.id"/>
274 </xsl:variable>
275 <xsl:variable name="title">
276 <xsl:apply-templates select="." mode="title.markup"/>
277 </xsl:variable>
278
279 <tocitem target="{$id}">
280 <xsl:attribute name="text">
281 <xsl:value-of select="$title"/>
282 </xsl:attribute>
283 <xsl:apply-templates select="sect5" mode="jhtoc"/>
284 </tocitem>
285</xsl:template>
286
287<xsl:template match="sect5|colophon" mode="jhtoc">
288 <xsl:variable name="id">
289 <xsl:call-template name="object.id"/>
290 </xsl:variable>
291 <xsl:variable name="title">
292 <xsl:apply-templates select="." mode="title.markup"/>
293 </xsl:variable>
294
295 <tocitem target="{$id}">
296 <xsl:attribute name="text">
297 <xsl:value-of select="$title"/>
298 </xsl:attribute>
299 </tocitem>
300</xsl:template>
301
302<!-- ==================================================================== -->
303
304<xsl:template name="helpmap">
305 <xsl:call-template name="write.chunk.with.doctype">
306 <xsl:with-param name="filename" select="concat($base.dir, 'jhelpmap.jhm')"/>
307 <xsl:with-param name="method" select="'xml'"/>
308 <xsl:with-param name="indent" select="'yes'"/>
309 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN'"/>
310 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/map_1_0.dtd'"/>
311 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
312 <xsl:with-param name="content">
313 <xsl:call-template name="helpmap.content"/>
314 </xsl:with-param>
315 </xsl:call-template>
316</xsl:template>
317
318<xsl:template name="helpmap.content">
319 <map version="1.0">
320 <xsl:choose>
321 <xsl:when test="$rootid != ''">
322 <xsl:apply-templates select="key('id',$rootid)//set
323 | key('id',$rootid)//book
324 | key('id',$rootid)//part
325 | key('id',$rootid)//reference
326 | key('id',$rootid)//preface
327 | key('id',$rootid)//chapter
328 | key('id',$rootid)//appendix
329 | key('id',$rootid)//article
330 | key('id',$rootid)//colophon
331 | key('id',$rootid)//refentry
332 | key('id',$rootid)//section
333 | key('id',$rootid)//sect1
334 | key('id',$rootid)//sect2
335 | key('id',$rootid)//sect3
336 | key('id',$rootid)//sect4
337 | key('id',$rootid)//sect5
338 | key('id',$rootid)//indexterm"
339 mode="map"/>
340 </xsl:when>
341 <xsl:otherwise>
342 <xsl:apply-templates select="//set
343 | //book
344 | //part
345 | //reference
346 | //preface
347 | //chapter
348 | //appendix
349 | //article
350 | //colophon
351 | //refentry
352 | //section
353 | //sect1
354 | //sect2
355 | //sect3
356 | //sect4
357 | //sect5
358 | //indexterm"
359 mode="map"/>
360 </xsl:otherwise>
361 </xsl:choose>
362 </map>
363</xsl:template>
364
365<xsl:template match="set" mode="map">
366 <xsl:variable name="id">
367 <xsl:call-template name="object.id">
368 <xsl:with-param name="object" select="."/>
369 </xsl:call-template>
370 </xsl:variable>
371
372 <mapID target="{$id}">
373 <xsl:attribute name="url">
374 <xsl:call-template name="href.target.uri"/>
375 </xsl:attribute>
376 </mapID>
377</xsl:template>
378
379<xsl:template match="book" mode="map">
380 <xsl:variable name="id">
381 <xsl:call-template name="object.id"/>
382 </xsl:variable>
383
384 <mapID target="{$id}">
385 <xsl:attribute name="url">
386 <xsl:call-template name="href.target.uri"/>
387 </xsl:attribute>
388 </mapID>
389</xsl:template>
390
391<xsl:template match="part|reference|preface|chapter|appendix|article"
392 mode="map">
393 <xsl:variable name="id">
394 <xsl:call-template name="object.id"/>
395 </xsl:variable>
396
397 <mapID target="{$id}">
398 <xsl:attribute name="url">
399 <xsl:call-template name="href.target.uri"/>
400 </xsl:attribute>
401 </mapID>
402</xsl:template>
403
404<xsl:template match="section|sect1|sect2|sect3|sect4|sect5|colophon" mode="map">
405 <xsl:variable name="id">
406 <xsl:call-template name="object.id"/>
407 </xsl:variable>
408
409 <mapID target="{$id}">
410 <xsl:attribute name="url">
411 <xsl:call-template name="href.target.uri"/>
412 </xsl:attribute>
413 </mapID>
414</xsl:template>
415
416<xsl:template match="indexterm" mode="map">
417 <xsl:variable name="id">
418 <xsl:call-template name="object.id"/>
419 </xsl:variable>
420
421 <mapID target="{$id}">
422 <xsl:attribute name="url">
423 <xsl:call-template name="href.target.uri"/>
424 </xsl:attribute>
425 </mapID>
426</xsl:template>
427
428<!-- ==================================================================== -->
429
430<xsl:template name="helpidx">
431 <xsl:call-template name="write.chunk.with.doctype">
432 <xsl:with-param name="filename" select="concat($base.dir, 'jhelpidx.xml')"/>
433 <xsl:with-param name="method" select="'xml'"/>
434 <xsl:with-param name="indent" select="'yes'"/>
435 <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN'"/>
436 <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/index_1_0.dtd'"/>
437 <xsl:with-param name="encoding" select="$javahelp.encoding"/>
438 <xsl:with-param name="content">
439 <xsl:call-template name="helpidx.content"/>
440 </xsl:with-param>
441 </xsl:call-template>
442</xsl:template>
443
444<xsl:template name="helpidx.content">
445 <index version="1.0">
446 <xsl:choose>
447 <xsl:when test="$rootid != ''">
448 <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx"/>
449 </xsl:when>
450 <xsl:otherwise>
451 <xsl:apply-templates select="//indexterm" mode="idx"/>
452 </xsl:otherwise>
453 </xsl:choose>
454 </index>
455</xsl:template>
456
457<xsl:template match="indexterm" mode="idx">
458 <xsl:variable name="id">
459 <xsl:call-template name="object.id"/>
460 </xsl:variable>
461
462 <xsl:variable name="text">
463 <xsl:value-of select="primary"/>
464 <xsl:if test="secondary">
465 <xsl:text>, </xsl:text>
466 <xsl:value-of select="secondary"/>
467 </xsl:if>
468 <xsl:if test="tertiary">
469 <xsl:text>, </xsl:text>
470 <xsl:value-of select="tertiary"/>
471 </xsl:if>
472 </xsl:variable>
473
474 <xsl:choose>
475 <xsl:when test="see">
476 <xsl:variable name="see"><xsl:value-of select="see"/></xsl:variable>
477 <indexitem text="{$text} see '{$see}'"/>
478 </xsl:when>
479 <xsl:otherwise>
480 <indexitem text="{$text}" target="{$id}"/>
481 </xsl:otherwise>
482 </xsl:choose>
483</xsl:template>
484
485<!-- ==================================================================== -->
486<!-- Kludge for Xalan outputting &trade; which fails in javahelp -->
487<xsl:template name="dingbat.characters">
488 <!-- now that I'm using the real serializer, all that dingbat malarky -->
489 <!-- isn't necessary anymore... -->
490 <xsl:param name="dingbat">bullet</xsl:param>
491
492 <xsl:choose>
493 <xsl:when test="$dingbat='bullet'">&#x2022;</xsl:when>
494 <xsl:when test="$dingbat='copyright'">&#x00A9;</xsl:when>
495 <xsl:when test="$dingbat='trademark' or $dingbat='trade'">
496 <xsl:choose>
497 <xsl:when test="contains(system-property('xsl:vendor'),
498 'Apache Software Foundation')">
499 <sup>TM</sup>
500 </xsl:when>
501 <xsl:otherwise>&#x2122;</xsl:otherwise>
502 </xsl:choose>
503 </xsl:when>
504 <xsl:when test="$dingbat='registered'">&#x00AE;</xsl:when>
505 <xsl:when test="$dingbat='service'">(SM)</xsl:when>
506 <xsl:when test="$dingbat='nbsp'">&#x00A0;</xsl:when>
507 <xsl:when test="$dingbat='ldquo'">&#x201C;</xsl:when>
508 <xsl:when test="$dingbat='rdquo'">&#x201D;</xsl:when>
509 <xsl:when test="$dingbat='lsquo'">&#x2018;</xsl:when>
510 <xsl:when test="$dingbat='rsquo'">&#x2019;</xsl:when>
511 <xsl:when test="$dingbat='em-dash'">&#x2014;</xsl:when>
512 <xsl:when test="$dingbat='mdash'">&#x2014;</xsl:when>
513 <xsl:when test="$dingbat='en-dash'">&#x2013;</xsl:when>
514 <xsl:when test="$dingbat='ndash'">&#x2013;</xsl:when>
515 <xsl:otherwise>
516 <xsl:text>&#x2022;</xsl:text>
517 </xsl:otherwise>
518 </xsl:choose>
519</xsl:template>
520
521</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.