]> granicus.if.org Git - docbook-dsssl/commitdiff
Removed obsolete XT support; added support for rootid parameter
authorNorman Walsh <ndw@nwalsh.com>
Tue, 27 Nov 2001 13:30:38 +0000 (13:30 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Tue, 27 Nov 2001 13:30:38 +0000 (13:30 +0000)
xsl/htmlhelp/htmlhelp-common.xsl [deleted file]
xsl/htmlhelp/htmlhelp.xsl
xsl/htmlhelp/xthtmlhelp.xsl [deleted file]
xsl/javahelp/javahelp-common.xsl [deleted file]
xsl/javahelp/javahelp.xsl
xsl/javahelp/xtjavahelp.xsl [deleted file]

diff --git a/xsl/htmlhelp/htmlhelp-common.xsl b/xsl/htmlhelp/htmlhelp-common.xsl
deleted file mode 100644 (file)
index 0d20b17..0000000
+++ /dev/null
@@ -1,551 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
-                exclude-result-prefixes="doc"
-                version="1.0">
-
-<!-- ********************************************************************
-     $Id$
-     ******************************************************************** 
-
-     This file is used by htmlhelp.xsl if you want to generate source
-     files for HTML Help.  It is based on the XSL DocBook Stylesheet
-     distribution (especially on JavaHelp code) from Norman Walsh.
-
-     ******************************************************************** -->
-
-
-<!-- ==================================================================== -->
-<!-- Customizations of standard HTML stylesheet parameters -->
-
-<xsl:param name="suppress.navigation" select="1"/>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="/">
-  <xsl:apply-templates/>
-  <xsl:call-template name="hhp"/>
-  <xsl:call-template name="hhc"/>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="hhp">
-  <xsl:call-template name="write.text.chunk">
-    <xsl:with-param name="filename" select="$htmlhelp.hhp"/>
-    <xsl:with-param name="method" select="'text'"/>
-    <xsl:with-param name="content">
-      <xsl:call-template name="hhp-main"/>
-    </xsl:with-param>
-    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
-  </xsl:call-template>
-</xsl:template>
-
-<!-- ==================================================================== -->
-<xsl:template name="hhp-main">
-<xsl:text>[OPTIONS]
-</xsl:text>
-<xsl:if test="//indexterm">
-<xsl:text>Auto Index=Yes
-</xsl:text></xsl:if>
-<xsl:text>Compatibility=1.1 or later
-Compiled file=</xsl:text><xsl:value-of select="$htmlhelp.chm"/><xsl:text>
-Contents file=</xsl:text><xsl:value-of select="$htmlhelp.hhc"/><xsl:text>
-Default topic=</xsl:text>
- <xsl:call-template name="make-relative-filename">
-   <xsl:with-param name="base.dir" select="$base.dir"/>
-   <xsl:with-param name="base.name">
-     <xsl:apply-templates mode="chunk-filename" select="/"/>
-   </xsl:with-param>
- </xsl:call-template>
-<xsl:text>
-Display compile progress=No
-Full-text search=Yes
-Language=</xsl:text>
-<xsl:if test="//@lang">
-  <xsl:variable name="lang" select="//@lang[1]"/>
-  <xsl:value-of select="document('langcodes.xml')//gentext[@lang=string($lang)]"/>
-</xsl:if>
-<xsl:if test="not(//@lang)">
-  <xsl:text>0x0409 English (United States)</xsl:text>
-</xsl:if>
-<xsl:text>
-Title=</xsl:text><xsl:value-of select="normalize-space(//title[1])"/>
-<xsl:text>
-
-[FILES]
-</xsl:text>
-<xsl:apply-templates mode="enumerate-files"/>
-<xsl:if test="$htmlhelp.enumerate.images">
-  <xsl:apply-templates mode="enumerate-images"/>
-</xsl:if>
-<xsl:value-of select="$htmlhelp.hhp.tail"/>
-</xsl:template>
-<!-- ==================================================================== -->
-
-<xsl:template match="set|book|part|preface|chapter|appendix
-                     |article
-                     |reference|refentry
-                     |sect1[position()>1]
-                     |section[position()>1 and name(parent::*) != 'section']
-                     |book/glossary|article/glossary
-                     |book/bibliography|article/bibliography
-                     |colophon"
-              mode="enumerate-files">
-  <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
-  <xsl:if test="$ischunk='1'">
-    <xsl:call-template name="make-relative-filename">
-      <xsl:with-param name="base.dir" select="$base.dir"/>
-      <xsl:with-param name="base.name">
-        <xsl:apply-templates mode="chunk-filename" select="."/>
-      </xsl:with-param>
-    </xsl:call-template>
-    <xsl:text>&#10;</xsl:text>
-  </xsl:if>
-  <xsl:apply-templates select="*" mode="enumerate-files"/>
-</xsl:template>
-
-<xsl:template match="text()" mode="enumerate-files">
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="graphic|inlinegraphic[@format!='linespecific']" mode="enumerate-images">
-  <xsl:call-template name="mediaobject.filename.enumerate-images">
-    <xsl:with-param name="object" select="."/>
-  </xsl:call-template>  
-  <xsl:text>&#10;</xsl:text>
-</xsl:template>
-
-<xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
-  <xsl:call-template name="select.mediaobject.enumerate-images"/>
-</xsl:template>
-
-<xsl:template name="select.mediaobject.enumerate-images" mode="enumerate-images">
-  <xsl:param name="olist"
-             select="imageobject|imageobjectco
-                     |videoobject|audioobject|textobject"/>
-  <xsl:param name="count">1</xsl:param>
-
-  <xsl:if test="$count &lt;= count($olist)">
-    <xsl:variable name="object" select="$olist[position()=$count]"/>
-
-    <xsl:variable name="useobject">
-      <xsl:choose>
-       <!-- The phrase is never used -->
-        <xsl:when test="name($object)='textobject' and $object/phrase">
-          <xsl:text>0</xsl:text>
-        </xsl:when>
-       <!-- The first textobject is a reasonable fallback (but not for image in HH) -->
-        <xsl:when test="name($object)='textobject'">
-          <xsl:text>0</xsl:text>
-        </xsl:when>
-       <!-- If there's only one object, use it -->
-       <xsl:when test="$count = 1 and count($olist) = 1">
-         <xsl:text>1</xsl:text>
-       </xsl:when>
-       <!-- Otherwise, see if this one is a useable graphic -->
-        <xsl:otherwise>
-          <xsl:choose>
-            <!-- peek inside imageobjectco to simplify the test -->
-            <xsl:when test="local-name($object) = 'imageobjectco'">
-              <xsl:call-template name="is.acceptable.mediaobject">
-                <xsl:with-param name="object" select="$object/imageobject"/>
-              </xsl:call-template>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:call-template name="is.acceptable.mediaobject">
-                <xsl:with-param name="object" select="$object"/>
-              </xsl:call-template>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-
-    <xsl:choose>
-      <xsl:when test="$useobject='1' and $object[not(*/@format='linespecific')]">
-       <xsl:call-template name="mediaobject.filename.enumerate-images">
-         <xsl:with-param name="object" select="$object"/>
-       </xsl:call-template>
-        <xsl:text>&#10;</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:call-template name="select.mediaobject.enumerate-images">
-          <xsl:with-param name="olist" select="$olist"/>
-          <xsl:with-param name="count" select="$count + 1"/>
-        </xsl:call-template>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template name="mediaobject.filename.enumerate-images" mode="enumerate-images">
-  <xsl:param name="object"/>
-
-  <xsl:variable name="urifilename">
-    <xsl:call-template name="mediaobject.filename">
-      <xsl:with-param name="object" select="$object"/>
-    </xsl:call-template>
-  </xsl:variable>
-
-  <xsl:variable name="filename">
-    <xsl:choose>
-      <xsl:when test="starts-with($urifilename, 'file:/')">
-       <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
-      </xsl:when>
-      <xsl:otherwise>
-       <xsl:value-of select="$urifilename"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:value-of select="translate($filename, '/', '\')"/>
-
-</xsl:template>
-
-<xsl:template match="text()" mode="enumerate-images">
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<!-- Following templates are not nice. It is because MS help compiler is unable
-     to process correct HTML files. We must generate following weird
-     stuff instead. -->
-
-<xsl:template name="hhc">
-  <xsl:call-template name="write.text.chunk">
-    <xsl:with-param name="filename" select="$htmlhelp.hhc"/>
-    <xsl:with-param name="method" select="'text'"/>
-    <xsl:with-param name="content">
-      <xsl:call-template name="hhc-main"/>
-    </xsl:with-param>
-    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
-  </xsl:call-template>
-</xsl:template>
-
-<xsl:template name="hhc-main">
-    <xsl:text>&lt;HTML&gt;
-&lt;HEAD&gt;
-&lt;/HEAD&gt;
-&lt;BODY&gt;
-&lt;OBJECT type="text/site properties"&gt;
-       &lt;param name="ImageType" value="Folder"&gt;
-&lt;/OBJECT&gt;
-&lt;UL&gt;
-</xsl:text>
-      <xsl:apply-templates select="." mode="hhc"/>
-<xsl:text>&lt;/UL&gt;
-&lt;/BODY&gt;
-&lt;/HTML&gt;</xsl:text>
-</xsl:template>
-
-<xsl:template match="set" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="book">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="book" mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="book" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="part|reference|preface|chapter|appendix|bibliography|article|colophon">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon"
-                          mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="part|reference|preface|chapter|bibliography|appendix|article"
-              mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates
-       select="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
-       mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="section" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="section">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="section" mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="sect1" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="sect2">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="sect2"
-                          mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="sect2" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="sect3">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="sect3"
-                          mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="sect3" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="sect4">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="sect4"
-                          mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="sect4" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-  <xsl:if test="sect5">
-    <xsl:text>&lt;UL&gt;</xsl:text>
-      <xsl:apply-templates select="sect5"
-                          mode="hhc"/>
-    <xsl:text>&lt;/UL&gt;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match="sect5|refentry|colophon|bibliodiv" mode="hhc">
-  <xsl:variable name="title">
-    <xsl:if test="$htmlhelp.autolabel=1">
-      <xsl:variable name="label.markup">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:if test="normalize-space($label.markup)">
-        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
-      </xsl:if>
-    </xsl:if>
-    <xsl:apply-templates select="." mode="title.markup"/>
-  </xsl:variable>
-
-  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
-    &lt;param name="Name" value="</xsl:text>
-       <xsl:value-of select="normalize-space($title)"/>
-    <xsl:text>"&gt;
-    &lt;param name="Local" value="</xsl:text>
-       <xsl:call-template name="href.target.with.base.dir"/>
-    <xsl:text>"&gt;
-  &lt;/OBJECT&gt;</xsl:text>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<!-- no separate HTML page with index -->
-<xsl:template match="index"/>   
-<xsl:template match="index" mode="toc"/>
-
-<xsl:template match="indexterm">
-
-  <xsl:variable name="primary" select="normalize-space(primary)"/>
-  <xsl:variable name="secondary" select="normalize-space(secondary)"/>
-  <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
-
-  <xsl:variable name="text">
-    <xsl:value-of select="$primary"/>
-    <xsl:if test="secondary">
-      <xsl:text>, </xsl:text>
-      <xsl:value-of select="$secondary"/>
-    </xsl:if>
-    <xsl:if test="tertiary">
-      <xsl:text>, </xsl:text>
-      <xsl:value-of select="$tertiary"/>
-    </xsl:if>
-  </xsl:variable>
-
-  <xsl:if test="secondary">
-    <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
-      <xsl:call-template name="write.indexterm">
-        <xsl:with-param name="text" select="$primary"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:if>
-
-  <xsl:call-template name="write.indexterm">
-    <xsl:with-param name="text" select="$text"/>
-  </xsl:call-template>
-
-</xsl:template>
-
-<xsl:template name="write.indexterm">
-  <xsl:param name="text"/>
-  <OBJECT type="application/x-oleobject"
-          classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
-    <param name="Keyword" value="{$text}"/>
-  </OBJECT>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="href.target.with.base.dir">
-  <xsl:value-of select="$base.dir"/>
-  <xsl:call-template name="href.target"/>
-</xsl:template>
-
-
-</xsl:stylesheet>
index 710ee606eab8b3373701bebb658ac3b84970af69..a1e228f883bcb38e06c4a64dfa412ee7bf48481a 100644 (file)
@@ -4,8 +4,603 @@
                version="1.0"
                 exclude-result-prefixes="doc">
 
+<!-- ********************************************************************
+     $Id$
+     ******************************************************************** 
+
+     This file is used by htmlhelp.xsl if you want to generate source
+     files for HTML Help.  It is based on the XSL DocBook Stylesheet
+     distribution (especially on JavaHelp code) from Norman Walsh.
+
+     ******************************************************************** -->
+
 <xsl:import href="../html/chunk.xsl"/>
-<xsl:include href="htmlhelp-common.xsl"/>
+
+<!-- ==================================================================== -->
+<!-- Customizations of standard HTML stylesheet parameters -->
+
+<xsl:param name="suppress.navigation" select="1"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/">
+  <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:call-template name="hhp"/>
+  <xsl:call-template name="hhc"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="hhp">
+  <xsl:call-template name="write.text.chunk">
+    <xsl:with-param name="filename" select="$htmlhelp.hhp"/>
+    <xsl:with-param name="method" select="'text'"/>
+    <xsl:with-param name="content">
+      <xsl:call-template name="hhp-main"/>
+    </xsl:with-param>
+    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+<xsl:template name="hhp-main">
+<xsl:text>[OPTIONS]
+</xsl:text>
+<xsl:if test="//indexterm">
+<xsl:text>Auto Index=Yes
+</xsl:text></xsl:if>
+<xsl:text>Compatibility=1.1 or later
+Compiled file=</xsl:text><xsl:value-of select="$htmlhelp.chm"/><xsl:text>
+Contents file=</xsl:text><xsl:value-of select="$htmlhelp.hhc"/><xsl:text>
+Default topic=</xsl:text>
+ <xsl:call-template name="make-relative-filename">
+   <xsl:with-param name="base.dir" select="$base.dir"/>
+   <xsl:with-param name="base.name">
+     <xsl:choose>
+       <xsl:when test="$rootid != ''">
+         <xsl:apply-templates select="key('id',$rootid)" mode="chunk-filename"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates select="/" mode="chunk-filename"/>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:with-param>
+ </xsl:call-template>
+<xsl:text>
+Display compile progress=No
+Full-text search=Yes
+Language=</xsl:text>
+<xsl:if test="//@lang">
+  <xsl:variable name="lang" select="//@lang[1]"/>
+  <xsl:value-of select="document('langcodes.xml')//gentext[@lang=string($lang)]"/>
+</xsl:if>
+<xsl:if test="not(//@lang)">
+  <xsl:text>0x0409 English (United States)</xsl:text>
+</xsl:if>
+<xsl:text>
+Title=</xsl:text><xsl:value-of select="normalize-space(//title[1])"/>
+<xsl:text>
+
+[FILES]
+</xsl:text>
+
+<xsl:choose>
+  <xsl:when test="$rootid != ''">
+    <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-files"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:apply-templates mode="enumerate-files"/>
+  </xsl:otherwise>
+</xsl:choose>
+
+<xsl:if test="$htmlhelp.enumerate.images">
+  <xsl:choose>
+    <xsl:when test="$rootid != ''">
+      <xsl:apply-templates select="key('id',$rootid)" mode="enumerate-images"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates mode="enumerate-images"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:if>
+<xsl:value-of select="$htmlhelp.hhp.tail"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="set|book|part|preface|chapter|appendix
+                     |article
+                     |reference|refentry
+                     |sect1[position()>1]
+                     |section[position()>1 and name(parent::*) != 'section']
+                     |book/glossary|article/glossary
+                     |book/bibliography|article/bibliography
+                     |colophon"
+              mode="enumerate-files">
+  <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
+  <xsl:if test="$ischunk='1'">
+    <xsl:call-template name="make-relative-filename">
+      <xsl:with-param name="base.dir" select="$base.dir"/>
+      <xsl:with-param name="base.name">
+        <xsl:apply-templates mode="chunk-filename" select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:if>
+  <xsl:apply-templates select="*" mode="enumerate-files"/>
+</xsl:template>
+
+<xsl:template match="text()" mode="enumerate-files">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="graphic|inlinegraphic[@format!='linespecific']" mode="enumerate-images">
+  <xsl:call-template name="mediaobject.filename.enumerate-images">
+    <xsl:with-param name="object" select="."/>
+  </xsl:call-template>  
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
+  <xsl:call-template name="select.mediaobject.enumerate-images"/>
+</xsl:template>
+
+<xsl:template name="select.mediaobject.enumerate-images" mode="enumerate-images">
+  <xsl:param name="olist"
+             select="imageobject|imageobjectco
+                     |videoobject|audioobject|textobject"/>
+  <xsl:param name="count">1</xsl:param>
+
+  <xsl:if test="$count &lt;= count($olist)">
+    <xsl:variable name="object" select="$olist[position()=$count]"/>
+
+    <xsl:variable name="useobject">
+      <xsl:choose>
+       <!-- The phrase is never used -->
+        <xsl:when test="name($object)='textobject' and $object/phrase">
+          <xsl:text>0</xsl:text>
+        </xsl:when>
+       <!-- The first textobject is a reasonable fallback (but not for image in HH) -->
+        <xsl:when test="name($object)='textobject'">
+          <xsl:text>0</xsl:text>
+        </xsl:when>
+       <!-- If there's only one object, use it -->
+       <xsl:when test="$count = 1 and count($olist) = 1">
+         <xsl:text>1</xsl:text>
+       </xsl:when>
+       <!-- Otherwise, see if this one is a useable graphic -->
+        <xsl:otherwise>
+          <xsl:choose>
+            <!-- peek inside imageobjectco to simplify the test -->
+            <xsl:when test="local-name($object) = 'imageobjectco'">
+              <xsl:call-template name="is.acceptable.mediaobject">
+                <xsl:with-param name="object" select="$object/imageobject"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="is.acceptable.mediaobject">
+                <xsl:with-param name="object" select="$object"/>
+              </xsl:call-template>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$useobject='1' and $object[not(*/@format='linespecific')]">
+       <xsl:call-template name="mediaobject.filename.enumerate-images">
+         <xsl:with-param name="object" select="$object"/>
+       </xsl:call-template>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="select.mediaobject.enumerate-images">
+          <xsl:with-param name="olist" select="$olist"/>
+          <xsl:with-param name="count" select="$count + 1"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="mediaobject.filename.enumerate-images" mode="enumerate-images">
+  <xsl:param name="object"/>
+
+  <xsl:variable name="urifilename">
+    <xsl:call-template name="mediaobject.filename">
+      <xsl:with-param name="object" select="$object"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="starts-with($urifilename, 'file:/')">
+       <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="$urifilename"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:value-of select="translate($filename, '/', '\')"/>
+
+</xsl:template>
+
+<xsl:template match="text()" mode="enumerate-images">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- Following templates are not nice. It is because MS help compiler is unable
+     to process correct HTML files. We must generate following weird
+     stuff instead. -->
+
+<xsl:template name="hhc">
+  <xsl:call-template name="write.text.chunk">
+    <xsl:with-param name="filename" select="$htmlhelp.hhc"/>
+    <xsl:with-param name="method" select="'text'"/>
+    <xsl:with-param name="content">
+      <xsl:call-template name="hhc-main"/>
+    </xsl:with-param>
+    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="hhc-main">
+  <xsl:text>&lt;HTML&gt;
+&lt;HEAD&gt;
+&lt;/HEAD&gt;
+&lt;BODY&gt;
+&lt;OBJECT type="text/site properties"&gt;
+       &lt;param name="ImageType" value="Folder"&gt;
+&lt;/OBJECT&gt;
+&lt;UL&gt;
+</xsl:text>
+
+  <xsl:choose>
+    <xsl:when test="$rootid != ''">
+      <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates mode="hhc"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:text>&lt;/UL&gt;
+&lt;/BODY&gt;
+&lt;/HTML&gt;</xsl:text>
+</xsl:template>
+
+<xsl:template match="set" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="book">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="book" mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="book" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="part|reference|preface|chapter|appendix|bibliography|article|colophon">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon"
+                          mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="part|reference|preface|chapter|bibliography|appendix|article"
+              mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates
+       select="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
+       mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="section" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="section">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="section" mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="sect1" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="sect2">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="sect2"
+                          mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="sect2" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="sect3">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="sect3"
+                          mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="sect3" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="sect4">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="sect4"
+                          mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="sect4" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+  <xsl:if test="sect5">
+    <xsl:text>&lt;UL&gt;</xsl:text>
+      <xsl:apply-templates select="sect5"
+                          mode="hhc"/>
+    <xsl:text>&lt;/UL&gt;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="sect5|refentry|colophon|bibliodiv" mode="hhc">
+  <xsl:variable name="title">
+    <xsl:if test="$htmlhelp.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:text>&lt;LI&gt; &lt;OBJECT type="text/sitemap"&gt;
+    &lt;param name="Name" value="</xsl:text>
+       <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text>"&gt;
+    &lt;param name="Local" value="</xsl:text>
+       <xsl:call-template name="href.target.with.base.dir"/>
+    <xsl:text>"&gt;
+  &lt;/OBJECT&gt;</xsl:text>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- no separate HTML page with index -->
+<xsl:template match="index"/>   
+<xsl:template match="index" mode="toc"/>
+
+<xsl:template match="indexterm">
+
+  <xsl:variable name="primary" select="normalize-space(primary)"/>
+  <xsl:variable name="secondary" select="normalize-space(secondary)"/>
+  <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
+
+  <xsl:variable name="text">
+    <xsl:value-of select="$primary"/>
+    <xsl:if test="secondary">
+      <xsl:text>, </xsl:text>
+      <xsl:value-of select="$secondary"/>
+    </xsl:if>
+    <xsl:if test="tertiary">
+      <xsl:text>, </xsl:text>
+      <xsl:value-of select="$tertiary"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="secondary">
+    <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
+      <xsl:call-template name="write.indexterm">
+        <xsl:with-param name="text" select="$primary"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:if>
+
+  <xsl:call-template name="write.indexterm">
+    <xsl:with-param name="text" select="$text"/>
+  </xsl:call-template>
+
+</xsl:template>
+
+<xsl:template name="write.indexterm">
+  <xsl:param name="text"/>
+  <OBJECT type="application/x-oleobject"
+          classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+    <param name="Keyword" value="{$text}"/>
+  </OBJECT>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="href.target.with.base.dir">
+  <xsl:value-of select="$base.dir"/>
+  <xsl:call-template name="href.target"/>
+</xsl:template>
 
 <xsl:template name="write.text.chunk">
   <xsl:param name="filename" select="''"/>
diff --git a/xsl/htmlhelp/xthtmlhelp.xsl b/xsl/htmlhelp/xthtmlhelp.xsl
deleted file mode 100644 (file)
index 2f5e48e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:xt="http://www.jclark.com/xt"
-                extension-element-prefixes="xt"
-                version="1.0">
-
-<xsl:import href="../html/xtchunk.xsl"/>
-<xsl:include href="htmlhelp-common.xsl"/>
-
-<xsl:template name="write.text.chunk">
-  <xsl:param name="filename" select="''"/>
-  <xsl:param name="method" select="'html'"/>
-  <xsl:param name="content" select="''"/>
-  <xsl:param name="encoding" select="'iso-8859-1'"/>
-
-  <!-- XT bug, if method is an AVT, it doesn't work -->
-  <!-- encoding doesn't work as an AVT either -->
-  <xt:document method="text" href="{$filename}" encoding="iso-8859-1">
-    <xsl:copy-of select="$content"/>
-  </xt:document>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/javahelp/javahelp-common.xsl b/xsl/javahelp/javahelp-common.xsl
deleted file mode 100644 (file)
index f4da8bf..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
-                exclude-result-prefixes="doc"          
-                version="1.0">
-
-<xsl:output method="html"/>
-
-<!-- ********************************************************************
-     $Id$
-     ********************************************************************
-
-     This file is part of the XSL DocBook Stylesheet distribution.
-     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
-     and other information.
-
-     ******************************************************************** -->
-
-<!-- ==================================================================== -->
-<xsl:param name="javahelp.encoding" select="'ISO-8859-1'"/>
-
-<doc:param name="javahelp.encoding" xmlns="">
-<refpurpose>Character encoding to use in control files for Java Help.</refpurpose>
-<refdescription>
-<para>Java Help crashes on some characters when written as character
-references. In that case you can select appropriate encoding here.</para>
-</refdescription>
-</doc:param>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="/">
-  <xsl:apply-templates/>
-  <xsl:call-template name="helpset"/>
-  <xsl:call-template name="helptoc"/>
-  <xsl:call-template name="helpmap"/>
-  <xsl:call-template name="helpidx"/>
-</xsl:template>
-
-<xsl:template name="header.navigation">
-</xsl:template>
-
-<xsl:template name="footer.navigation">
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="helpset">
-  <xsl:call-template name="write.chunk.with.doctype">
-    <xsl:with-param name="filename" select="'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: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="$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="'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:call-template>
-</xsl:template>
-
-<xsl:template name="helptoc.content">
-  <toc version="1.0">
-    <xsl:apply-templates select="." mode="toc"/>
-  </toc>
-</xsl:template>
-
-<xsl:template match="set" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="book" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="book" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon"
-                         mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="part|reference|preface|chapter|appendix|article"
-              mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates
-      select="preface|chapter|appendix|refentry|section|sect1"
-      mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="section" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="section" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="sect1" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="sect2" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="sect2" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="sect3" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="sect3" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="sect4" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="sect4" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-    <xsl:apply-templates select="sect5" mode="toc"/>
-  </tocitem>
-</xsl:template>
-
-<xsl:template match="sect5|colophon" mode="toc">
-  <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="$title"/>
-    </xsl:attribute>
-  </tocitem>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="helpmap">
-  <xsl:call-template name="write.chunk.with.doctype">
-    <xsl:with-param name="filename" select="'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:call-template>
-</xsl:template>
-
-<xsl:template name="helpmap.content">
-  <map version="1.0">
-    <xsl:apply-templates select="//set
-                                 | //book
-                                 | //part
-                                 | //reference
-                                 | //preface
-                                 | //chapter
-                                 | //appendix
-                                 | //article
-                                 | //colophon
-                                 | //refentry
-                                 | //section
-                                 | //sect1
-                                 | //sect2
-                                 | //sect3
-                                 | //sect4
-                                 | //sect5
-                                 | //indexterm"
-       mode="map"/>
-  </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:apply-templates mode="chunk-filename" select="."/>
-    </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:apply-templates mode="chunk-filename" select="."/>
-    </xsl:attribute>
-  </mapID>
-</xsl:template>
-
-<xsl:template match="part|reference|preface|chapter|appendix|article"
-              mode="map">
-  <xsl:variable name="id">
-    <xsl:call-template name="object.id"/>
-  </xsl:variable>
-
-  <mapID target="{$id}">
-    <xsl:attribute name="url">
-      <xsl:apply-templates mode="chunk-filename" select="."/>
-    </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:apply-templates mode="chunk-filename" select="."/>
-    </xsl:attribute>
-  </mapID>
-</xsl:template>
-
-<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:apply-templates mode="chunk-filename" select="."/>
-    </xsl:attribute>
-  </mapID>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="helpidx">
-  <xsl:call-template name="write.chunk.with.doctype">
-    <xsl:with-param name="filename" select="'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:call-template>
-</xsl:template>
-
-<xsl:template name="helpidx.content">
-  <index version="1.0">
-    <xsl:apply-templates select="//indexterm" mode="idx"/>
-  </index>
-</xsl:template>
-
-<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="primary"/>
-    <xsl:if test="secondary">
-      <xsl:text>, </xsl:text>
-      <xsl:value-of select="secondary"/>
-    </xsl:if>
-    <xsl:if test="tertiary">
-      <xsl:text>, </xsl:text>
-      <xsl:value-of select="tertiary"/>
-    </xsl:if>
-  </xsl:variable>
-
-  <xsl:choose>
-    <xsl:when test="see">
-      <xsl:variable name="see"><xsl:value-of select="see"/></xsl:variable>
-      <indexitem text="{$text} see '{$see}'"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <indexitem text="{$text}" target="{$id}"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-</xsl:stylesheet>
\ No newline at end of file
index 1a159c559d0848ac0f0f3592bfba880cf6111d65..38b2597454374356f4e0fddb680c490dedfc04a8 100644 (file)
@@ -5,6 +5,483 @@
                 exclude-result-prefixes="doc">
 
 <xsl:import href="../html/chunk.xsl"/>
-<xsl:include href="javahelp-common.xsl"/>
+
+<xsl:output method="html"/>
+
+<!-- ********************************************************************
+     $Id$
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<xsl:param name="javahelp.encoding" select="'ISO-8859-1'"/>
+
+<doc:param name="javahelp.encoding" xmlns="">
+<refpurpose>Character encoding to use in control files for Java Help.</refpurpose>
+<refdescription>
+<para>Java Help crashes on some characters when written as character
+references. In that case you can select appropriate encoding here.</para>
+</refdescription>
+</doc:param>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/">
+  <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:call-template name="helpset"/>
+  <xsl:call-template name="helptoc"/>
+  <xsl:call-template name="helpmap"/>
+  <xsl:call-template name="helpidx"/>
+</xsl:template>
+
+
+<xsl:template name="header.navigation">
+</xsl:template>
+
+<xsl:template name="footer.navigation">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="helpset">
+  <xsl:call-template name="write.chunk.with.doctype">
+    <xsl:with-param name="filename" select="'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: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="$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="'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: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="toc"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates mode="toc"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </toc>
+</xsl:template>
+
+<xsl:template match="set" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="book" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="book" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon"
+                         mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="part|reference|preface|chapter|appendix|article"
+              mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates
+      select="preface|chapter|appendix|refentry|section|sect1"
+      mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="section" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="section" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="sect1" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="sect2" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="sect2" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="sect3" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="sect3" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="sect4" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="sect4" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+    <xsl:apply-templates select="sect5" mode="toc"/>
+  </tocitem>
+</xsl:template>
+
+<xsl:template match="sect5|colophon" mode="toc">
+  <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="$title"/>
+    </xsl:attribute>
+  </tocitem>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="helpmap">
+  <xsl:call-template name="write.chunk.with.doctype">
+    <xsl:with-param name="filename" select="'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: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"
+                             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"
+                             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:apply-templates mode="chunk-filename" select="."/>
+    </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:apply-templates mode="chunk-filename" select="."/>
+    </xsl:attribute>
+  </mapID>
+</xsl:template>
+
+<xsl:template match="part|reference|preface|chapter|appendix|article"
+              mode="map">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <mapID target="{$id}">
+    <xsl:attribute name="url">
+      <xsl:apply-templates mode="chunk-filename" select="."/>
+    </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:apply-templates mode="chunk-filename" select="."/>
+    </xsl:attribute>
+  </mapID>
+</xsl:template>
+
+<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:apply-templates mode="chunk-filename" select="."/>
+    </xsl:attribute>
+  </mapID>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="helpidx">
+  <xsl:call-template name="write.chunk.with.doctype">
+    <xsl:with-param name="filename" select="'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: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:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="//indexterm" mode="idx"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </index>
+</xsl:template>
+
+<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="primary"/>
+    <xsl:if test="secondary">
+      <xsl:text>, </xsl:text>
+      <xsl:value-of select="secondary"/>
+    </xsl:if>
+    <xsl:if test="tertiary">
+      <xsl:text>, </xsl:text>
+      <xsl:value-of select="tertiary"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="see">
+      <xsl:variable name="see"><xsl:value-of select="see"/></xsl:variable>
+      <indexitem text="{$text} see '{$see}'"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <indexitem text="{$text}" target="{$id}"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
 
 </xsl:stylesheet>
diff --git a/xsl/javahelp/xtjavahelp.xsl b/xsl/javahelp/xtjavahelp.xsl
deleted file mode 100644 (file)
index 8baf414..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
-               version="1.0"
-                exclude-result-prefixes="doc">
-
-<xsl:import href="../html/xtchunk.xsl"/>
-<xsl:include href="javahelp-common.xsl"/>
-
-<xsl:template match="/">
-  <xsl:message terminate="yes">
-    <xsl:text>JavaHelp cannot work with XT; XT does not support</xsl:text>
-    <xsl:text> writing doctype public and system identifiers</xsl:text>
-  </xsl:message>
-</xsl:template>
-
-</xsl:stylesheet>