]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support for generating olink target database for htmlhelp files.
authorBob Stayton <bobs@sagehill.net>
Thu, 5 Mar 2009 22:06:51 +0000 (22:06 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 5 Mar 2009 22:06:51 +0000 (22:06 +0000)
xsl/htmlhelp/htmlhelp-common.xsl

index 56c100a7cda5e49b699eaa1fcbef4328e9cc02bb..4108fbfd743ebdb2ebc44ba2a41d095965b22946 100644 (file)
         </xsl:choose>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="/" mode="process.root"/>
+        <xsl:if test="$collect.xref.targets = 'yes' or
+                      $collect.xref.targets = 'only'">
+          <xsl:apply-templates select="/" mode="collect.targets"/>
+        </xsl:if>
+        <xsl:if test="$collect.xref.targets != 'only'">
+          <xsl:apply-templates select="/" mode="process.root"/>
+        </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:if>
 
-  <xsl:call-template name="hhp"/>
-  <xsl:call-template name="hhc"/>
-  <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
-                ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
-    <xsl:call-template name="hh-map"/>
-    <xsl:call-template name="hh-alias"/>
-  </xsl:if>
-  <xsl:if test="$htmlhelp.generate.index">
-    <xsl:call-template name="hhk"/>
+
+  <xsl:if test="$collect.xref.targets != 'only'">
+    <xsl:call-template name="hhp"/>
+    <xsl:call-template name="hhc"/>
+    <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
+                  ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
+      <xsl:call-template name="hh-map"/>
+      <xsl:call-template name="hh-alias"/>
+    </xsl:if>
+    <xsl:if test="$htmlhelp.generate.index">
+      <xsl:call-template name="hhk"/>
+    </xsl:if>
   </xsl:if>
 </xsl:otherwise>
 </xsl:choose>
   <xsl:variable name="raw.help.title">
     <xsl:choose>
       <xsl:when test="$htmlhelp.title = ''">
-       <xsl:choose>
-         <xsl:when test="$rootid != ''">
-           <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
-         </xsl:when>
-         <xsl:otherwise>
-           <xsl:apply-templates select="/*" mode="title.markup"/>
-         </xsl:otherwise>
-       </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$rootid != ''">
+            <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="/*" mode="title.markup"/>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$htmlhelp.title"/>
+        <xsl:value-of select="$htmlhelp.title"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
@@ -426,19 +435,19 @@ Enhanced decompilation=</xsl:text>
 
     <xsl:variable name="useobject">
       <xsl:choose>
-       <!-- The phrase is never used -->
+        <!-- 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) -->
+        <!-- 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 -->
+        <!-- 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 -->
@@ -489,10 +498,10 @@ Enhanced decompilation=</xsl:text>
   <xsl:variable name="filename">
     <xsl:choose>
       <xsl:when test="starts-with($urifilename, 'file:/')">
-       <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
+        <xsl:value-of select="substring-after($urifilename, 'file:/')"/>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$urifilename"/>
+        <xsl:value-of select="$urifilename"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
@@ -551,10 +560,10 @@ Enhanced decompilation=</xsl:text>
   <xsl:variable name="content">
     <xsl:choose>
       <xsl:when test="$rootid != ''">
-       <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
+        <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:apply-templates select="/" mode="hhc"/>
+        <xsl:apply-templates select="/" mode="hhc"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
@@ -623,19 +632,19 @@ Enhanced decompilation=</xsl:text>
           </param>&lf;
           <param name="Local">
             <xsl:attribute name="value">
-             <xsl:choose>
-               <xsl:when test="$chunk.tocs.and.lots != 0">
-                 <xsl:apply-templates select="." mode="recursive-chunk-filename">
-                   <xsl:with-param name="recursive" select="true()"/>
-                 </xsl:apply-templates>
-                 <xsl:text>-toc</xsl:text>
-                 <xsl:value-of select="$html.ext"/>
-               </xsl:when>
-               <xsl:otherwise>
-                 <xsl:call-template name="href.target.with.base.dir"/>
-               </xsl:otherwise>
-             </xsl:choose>
-           </xsl:attribute>
+              <xsl:choose>
+                <xsl:when test="$chunk.tocs.and.lots != 0">
+                  <xsl:apply-templates select="." mode="recursive-chunk-filename">
+                    <xsl:with-param name="recursive" select="true()"/>
+                  </xsl:apply-templates>
+                  <xsl:text>-toc</xsl:text>
+                  <xsl:value-of select="$html.ext"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:call-template name="href.target.with.base.dir"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
           </param>
       </OBJECT></LI>&lf;
       </xsl:if>
@@ -659,31 +668,31 @@ Enhanced decompilation=</xsl:text>
         <LI><OBJECT type="text/sitemap">&lf;
             <param name="Name">
               <xsl:attribute name="value">
-               <xsl:call-template name="gentext">
-                 <xsl:with-param name="key" select="'TableofContents'"/>
-               </xsl:call-template>
+                <xsl:call-template name="gentext">
+                  <xsl:with-param name="key" select="'TableofContents'"/>
+                </xsl:call-template>
               </xsl:attribute>
             </param>&lf;
             <param name="Local">
-             <xsl:attribute name="value">
-               <xsl:choose>
-                 <xsl:when test="$chunk.tocs.and.lots != 0">
-                   <xsl:apply-templates select="." mode="recursive-chunk-filename">
-                     <xsl:with-param name="recursive" select="true()"/>
-                   </xsl:apply-templates>
-                   <xsl:text>-toc</xsl:text>
-                   <xsl:value-of select="$html.ext"/>
-                 </xsl:when>
-                 <xsl:otherwise>
-                   <xsl:call-template name="href.target.with.base.dir"/>
-                 </xsl:otherwise>
-               </xsl:choose>
-             </xsl:attribute>
+              <xsl:attribute name="value">
+                <xsl:choose>
+                  <xsl:when test="$chunk.tocs.and.lots != 0">
+                    <xsl:apply-templates select="." mode="recursive-chunk-filename">
+                      <xsl:with-param name="recursive" select="true()"/>
+                    </xsl:apply-templates>
+                    <xsl:text>-toc</xsl:text>
+                    <xsl:value-of select="$html.ext"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:call-template name="href.target.with.base.dir"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:attribute>
             </param>
         </OBJECT></LI>&lf;
       </xsl:if>
       <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon|glossary"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>&lf;
   </xsl:if>
 </xsl:template>
@@ -696,8 +705,8 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
     <UL>&lf;
       <xsl:apply-templates
-       select="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
-       mode="hhc"/>
+        select="article|reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
+        mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -720,7 +729,7 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="sect2[$htmlhelp.hhc.section.depth > 1]|refentry">
     <UL>&lf;
       <xsl:apply-templates select="sect2|refentry"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -732,7 +741,7 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="sect3[$htmlhelp.hhc.section.depth > 2]|refentry">
     <UL>&lf;
       <xsl:apply-templates select="sect3|refentry"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -744,7 +753,7 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="sect4[$htmlhelp.hhc.section.depth > 3]|refentry">
     <UL>&lf;
       <xsl:apply-templates select="sect4|refentry"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -756,7 +765,7 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="sect5[$htmlhelp.hhc.section.depth > 4]|refentry">
     <UL>&lf;
       <xsl:apply-templates select="sect5|refentry"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -768,7 +777,7 @@ Enhanced decompilation=</xsl:text>
   <xsl:if test="refentry">
     <UL>&lf;
       <xsl:apply-templates select="refentry"
-                          mode="hhc"/>
+                           mode="hhc"/>
     </UL>
   </xsl:if>
 </xsl:template>
@@ -805,7 +814,7 @@ Enhanced decompilation=</xsl:text>
 
       <xsl:if test="tertiary">
         <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and 
-                                     normalize-space(secondary)=$secondary and not(tertiary)])">
+                                      normalize-space(secondary)=$secondary and not(tertiary)])">
           <xsl:call-template name="write.indexterm">
             <xsl:with-param name="text" select="concat($primary, ', ', $secondary)"/>
           </xsl:call-template>
@@ -929,9 +938,9 @@ Enhanced decompilation=</xsl:text>
           <xsl:call-template name="href.target.with.base.dir"/>
         </xsl:variable>
         <xsl:variable name="title">
-         <xsl:call-template name="nearest.title">
-           <xsl:with-param name="object" select=".."/>
-         </xsl:call-template>
+          <xsl:call-template name="nearest.title">
+            <xsl:with-param name="object" select=".."/>
+          </xsl:call-template>
         </xsl:variable>
 
         <param name="Name">