123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621 |
- <?xml version="1.0"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
- xmlns:ng="http://docbook.org/docbook-ng"
- xmlns:db="http://docbook.org/ns/docbook"
- xmlns:exsl="http://exslt.org/common"
- version="1.0"
- exclude-result-prefixes="doc ng db exsl">
- <xsl:import href="../html/chunk.xsl"/>
- <xsl:output method="html"/>
- <!-- ********************************************************************
- $Id: javahelp.xsl 9152 2011-11-12 00:17:33Z bobstayton $
- ********************************************************************
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
- ******************************************************************** -->
- <!-- ==================================================================== -->
- <xsl:template match="/">
- <!-- * Get a title for current doc so that we let the user -->
- <!-- * know what document we are processing at this point. -->
- <xsl:variable name="doc.title">
- <xsl:call-template name="get.doc.title"/>
- </xsl:variable>
- <xsl:choose>
- <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
- toss the namespace and continue. Use the docbook5 namespaced
- stylesheets for DocBook5 if you don't want to use this feature.-->
- <xsl:when test="$exsl.node.set.available != 0
- and (*/self::ng:* or */self::db:*)">
- <xsl:call-template name="log.message">
- <xsl:with-param name="level">Note</xsl:with-param>
- <xsl:with-param name="source" select="$doc.title"/>
- <xsl:with-param name="context-desc">
- <xsl:text>namesp. cut</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="message">
- <xsl:text>stripped namespace before processing</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:variable name="nons">
- <xsl:apply-templates mode="stripNS"/>
- </xsl:variable>
- <xsl:call-template name="log.message">
- <xsl:with-param name="level">Note</xsl:with-param>
- <xsl:with-param name="source" select="$doc.title"/>
- <xsl:with-param name="context-desc">
- <xsl:text>namesp. cut</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="message">
- <xsl:text>processing stripped document</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:apply-templates select="exsl:node-set($nons)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:choose>
- <xsl:when test="count(key('id',$rootid)) = 0">
- <xsl:message terminate="yes">
- <xsl:text>ID '</xsl:text>
- <xsl:value-of select="$rootid"/>
- <xsl:text>' not found in document.</xsl:text>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
- <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="/" mode="process.root"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:for-each select="/"> <!-- This is just a hook for building profiling stylesheets -->
- <xsl:call-template name="helpset"/>
- <xsl:call-template name="helptoc"/>
- <xsl:call-template name="helpmap"/>
- <xsl:call-template name="helpidx"/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:param name="suppress.navigation" select="1"/>
- <!-- ==================================================================== -->
- <xsl:template name="helpset">
- <xsl:call-template name="write.chunk.with.doctype">
- <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelpset.hs')"/>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN'"/>
- <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/helpset_1_0.dtd'"/>
- <xsl:with-param name="content">
- <xsl:call-template name="helpset.content"/>
- </xsl:with-param>
- <xsl:with-param name="quiet" select="$chunk.quietly"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="helpset.content">
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <helpset version="1.0">
- <title>
- <xsl:value-of select="normalize-space($title)"/>
- </title>
- <!-- maps -->
- <maps>
- <homeID>top</homeID>
- <mapref location="jhelpmap.jhm"/>
- </maps>
- <!-- views -->
- <view>
- <name>TOC</name>
- <label>Table Of Contents</label>
- <type>javax.help.TOCView</type>
- <data>jhelptoc.xml</data>
- </view>
- <view>
- <name>Index</name>
- <label>Index</label>
- <type>javax.help.IndexView</type>
- <data>jhelpidx.xml</data>
- </view>
- <view>
- <name>Search</name>
- <label>Search</label>
- <type>javax.help.SearchView</type>
- <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
- </view>
- </helpset>
- </xsl:template>
- <!-- ==================================================================== -->
- <xsl:template name="helptoc">
- <xsl:call-template name="write.chunk.with.doctype">
- <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelptoc.xml')"/>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN'"/>
- <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/toc_1_0.dtd'"/>
- <xsl:with-param name="encoding" select="$javahelp.encoding"/>
- <xsl:with-param name="content">
- <xsl:call-template name="helptoc.content"/>
- </xsl:with-param>
- <xsl:with-param name="quiet" select="$chunk.quietly"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="helptoc.content">
- <toc version="1.0">
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:apply-templates select="key('id',$rootid)" mode="jhtoc"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="jhtoc"/>
- </xsl:otherwise>
- </xsl:choose>
- </toc>
- </xsl:template>
- <xsl:template match="set" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id">
- <xsl:with-param name="object" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="book" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="book" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon|glossary|bibliography"
- mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="part|reference|preface|chapter|appendix|article"
- mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates
- select="article|preface|chapter|appendix|refentry|section|sect1|glossary|bibliography"
- mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="section" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="section" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="sect1" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="sect2" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="sect2" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="sect3" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="sect3" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="sect4" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="sect4" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- <xsl:apply-templates select="sect5" mode="jhtoc"/>
- </tocitem>
- </xsl:template>
- <xsl:template match="sect5|colophon|refentry" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:attribute>
- </tocitem>
- </xsl:template>
- <xsl:template match="glossary" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'Glossary'"/>
- </xsl:call-template>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="$title"/>
- </xsl:attribute>
- </tocitem>
- </xsl:template>
- <xsl:template match="bibliography" mode="jhtoc">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="title">
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'Bibliography'"/>
- </xsl:call-template>
- </xsl:variable>
- <tocitem target="{$id}">
- <xsl:attribute name="text">
- <xsl:value-of select="$title"/>
- </xsl:attribute>
-
- </tocitem>
- </xsl:template>
- <!-- ==================================================================== -->
- <xsl:template name="helpmap">
- <xsl:call-template name="write.chunk.with.doctype">
- <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpmap.jhm')"/>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN'"/>
- <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/map_1_0.dtd'"/>
- <xsl:with-param name="encoding" select="$javahelp.encoding"/>
- <xsl:with-param name="content">
- <xsl:call-template name="helpmap.content"/>
- </xsl:with-param>
- <xsl:with-param name="quiet" select="$chunk.quietly"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="helpmap.content">
- <map version="1.0">
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:apply-templates select="key('id',$rootid)//set
- | key('id',$rootid)//book
- | key('id',$rootid)//part
- | key('id',$rootid)//reference
- | key('id',$rootid)//preface
- | key('id',$rootid)//chapter
- | key('id',$rootid)//appendix
- | key('id',$rootid)//article
- | key('id',$rootid)//colophon
- | key('id',$rootid)//refentry
- | key('id',$rootid)//section
- | key('id',$rootid)//sect1
- | key('id',$rootid)//sect2
- | key('id',$rootid)//sect3
- | key('id',$rootid)//sect4
- | key('id',$rootid)//sect5
- | key('id',$rootid)//indexterm
- | key('id',$rootid)//glossary
- | key('id',$rootid)//bibliography
- | key('id',$rootid)//*[@id]"
- mode="map"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="//set
- | //book
- | //part
- | //reference
- | //preface
- | //chapter
- | //appendix
- | //article
- | //colophon
- | //refentry
- | //section
- | //sect1
- | //sect2
- | //sect3
- | //sect4
- | //sect5
- | //indexterm
- | //glossary
- | //bibliography
- | //*[@id]"
- mode="map"/>
- </xsl:otherwise>
- </xsl:choose>
- </map>
- </xsl:template>
- <xsl:template match="set" mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id">
- <xsl:with-param name="object" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <xsl:template match="book" mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <xsl:template match="part|reference|preface|chapter|appendix|refentry|article|glossary|bibliography"
- mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <xsl:template match="section|sect1|sect2|sect3|sect4|sect5|colophon" mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <xsl:template match="indexterm[@class='endofrange']" mode="map"/>
- <xsl:template match="indexterm" mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <xsl:template match="*[@id]" mode="map">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <mapID target="{$id}">
- <xsl:attribute name="url">
- <xsl:call-template name="href.target.uri"/>
- </xsl:attribute>
- </mapID>
- </xsl:template>
- <!-- ==================================================================== -->
- <xsl:template name="helpidx">
- <xsl:call-template name="write.chunk.with.doctype">
- <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpidx.xml')"/>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN'"/>
- <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/index_1_0.dtd'"/>
- <xsl:with-param name="encoding" select="$javahelp.encoding"/>
- <xsl:with-param name="content">
- <xsl:call-template name="helpidx.content"/>
- </xsl:with-param>
- <xsl:with-param name="quiet" select="$chunk.quietly"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="helpidx.content">
- <index version="1.0">
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
- <xsl:sort select="primary"/>
- <xsl:sort select="secondary"/>
- <xsl:sort select="tertiary"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="//indexterm" mode="idx">
- <xsl:sort select="primary"/>
- <xsl:sort select="secondary"/>
- <xsl:sort select="tertiary"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </index>
- </xsl:template>
- <xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
- <xsl:template match="indexterm" mode="idx">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
- <xsl:variable name="text">
- <xsl:value-of select="normalize-space(primary)"/>
- <xsl:if test="secondary">
- <xsl:text>, </xsl:text>
- <xsl:value-of select="normalize-space(secondary)"/>
- </xsl:if>
- <xsl:if test="tertiary">
- <xsl:text>, </xsl:text>
- <xsl:value-of select="normalize-space(tertiary)"/>
- </xsl:if>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="see">
- <xsl:variable name="see"><xsl:value-of select="normalize-space(see)"/></xsl:variable>
- <indexitem text="{$text} see '{$see}'"/>
- </xsl:when>
- <xsl:otherwise>
- <indexitem text="{$text}" target="{$id}"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- ==================================================================== -->
- <!-- Kludge for Xalan outputting ™ which fails in javahelp -->
- <xsl:template name="dingbat.characters">
- <!-- now that I'm using the real serializer, all that dingbat malarky -->
- <!-- isn't necessary anymore... -->
- <xsl:param name="dingbat">bullet</xsl:param>
- <xsl:choose>
- <xsl:when test="$dingbat='bullet'">•</xsl:when>
- <xsl:when test="$dingbat='copyright'">©</xsl:when>
- <xsl:when test="$dingbat='trademark' or $dingbat='trade'">
- <xsl:choose>
- <xsl:when test="contains(system-property('xsl:vendor'),
- 'Apache Software Foundation')">
- <sup>TM</sup>
- </xsl:when>
- <xsl:otherwise>™</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$dingbat='registered'">®</xsl:when>
- <xsl:when test="$dingbat='service'">(SM)</xsl:when>
- <xsl:when test="$dingbat='nbsp'"> </xsl:when>
- <xsl:when test="$dingbat='ldquo'">“</xsl:when>
- <xsl:when test="$dingbat='rdquo'">”</xsl:when>
- <xsl:when test="$dingbat='lsquo'">‘</xsl:when>
- <xsl:when test="$dingbat='rsquo'">’</xsl:when>
- <xsl:when test="$dingbat='em-dash'">—</xsl:when>
- <xsl:when test="$dingbat='mdash'">—</xsl:when>
- <xsl:when test="$dingbat='en-dash'">–</xsl:when>
- <xsl:when test="$dingbat='ndash'">–</xsl:when>
- <xsl:otherwise>
- <xsl:text>•</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|