]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixing bug where current topic in toc wasn't highlighted but title was.
authorDavid Cramer <david@thingbag.net>
Tue, 6 Jul 2010 19:06:13 +0000 (19:06 +0000)
committerDavid Cramer <david@thingbag.net>
Tue, 6 Jul 2010 19:06:13 +0000 (19:06 +0000)
xsl/webhelp/template/common/main.js
xsl/webhelp/xsl/webhelp.xsl

index 1eebbfe8b0051224da09d0308956c0e00f06f9d4..0dc61a0d4d67856d07571b8ebdacd568499f3e89 100755 (executable)
@@ -64,16 +64,20 @@ function searchTabClick(e) {
  * @param id the node/element id which should be displayed when synching. 
  */
 function syncToc(id){
-    var a = document.getElementById(id);
+    var a = document.getElementById("webhelp-currentid");
+       var b = a.getElementsByTagName("a")[0];
 
     //Setting the background for selected node.
     var style = a.getAttribute("style");
     if(style != null && !style.match(/background-color: Background;/)){ 
-        a.setAttribute("style", "background-color: Background; "+style);
+        a.setAttribute("style", "background-color: Background;  "+style);
+               b.setAttribute("style", "color: white;");
     } else if(style != null){
-        a.setAttribute("style", "background-color: Background; " + style);
+        a.setAttribute("style", "background-color: Background;  " + style);
+               b.setAttribute("style", "color: white;");
     } else {
-        a.setAttribute("style", "background-color: Background; ");        
+        a.setAttribute("style", "background-color: Background;  ");        
+               b.setAttribute("style", "color: white;");
     }
     
        while (a.parentNode && a.parentNode.nodeName){
index e5078486154f96c029b093b1e354f5c09eea290e..8501e8aabb74d0620fff6a426411d7d79bddf95d 100755 (executable)
@@ -5,10 +5,10 @@
         version="1.0" xmlns="http://www.w3.org/1999/xhtml">
 
     <!--<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>-->
-    <!--xsl:import
-            href="c:/gsoc2010/docbook-webhelp/1Beta02/xsl/../../../docbook-xsl-1.75.2/xhtml/chunk.xsl"/--> 
     <xsl:import
-            href="file:///media/DATA/ACADEMIC/GSOC/docbook/repository/docbook/trunk/maven/docbook-xsl/target/docbook/xhtml/chunk.xsl"/>
+            href="c:/gsoc2010/docbook-xsl-1.75.2/xhtml/chunk.xsl"/> 
+    <!--xsl:import
+            href="file:///media/DATA/ACADEMIC/GSOC/docbook/repository/docbook/trunk/maven/docbook-xsl/target/docbook/xhtml/chunk.xsl"/-->
  
     <xsl:include href="keywords.xsl"/>
 
     </xsl:template>
 
     <xsl:template name="user.footer.navigation"> 
-        <xsl:call-template name="webhelptoc"/>
+       <xsl:call-template name="webhelptoc">
+                 <xsl:with-param name="currentid" select="generate-id(.)"/>
+            </xsl:call-template>
     </xsl:template>
 
     <xsl:template name="header.navigation">
           </xsl:call-template>
       </div>
         
-      <xsl:call-template name="user.footer.navigation"/>
+               <xsl:call-template name="user.footer.navigation"/>
     </body>
   </html>
   <xsl:value-of select="$chunk.append"/>
     </xsl:template>
 
     <xsl:template name="webhelptoc">
+       <xsl:param name="currentid"/>
         <xsl:choose>
             <xsl:when test="$rootid != ''">
                 <xsl:variable name="title">
                                 <img src="../common/images/loading.gif" alt="loading table of contents..."
                                      id="tocLoading" style="display:block;"/>
                                 <ul id="tree" class="filetree" style="display:none;">
-                                    <xsl:apply-templates select="/*/*" mode="webhelptoc"/>
+                                    <xsl:apply-templates select="/*/*" mode="webhelptoc">
+                                       <xsl:with-param name="currentid" select="$currentid"/>
+                                 </xsl:apply-templates>
                                 </ul>
                             </div>
                             <xsl:if test="$exclude.search.from.chunked.html != 'true'">
     <xsl:template
             match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index"
             mode="webhelptoc">
+       <xsl:param name="currentid"/>
         <xsl:variable name="title">
             <xsl:if test="$eclipse.autolabel=1">
                 <xsl:variable name="label.markup">
 
         <xsl:if test="not(self::index) or (self::index and not($generate.index = 0))">
             <!--li style="white-space: pre; line-height: 0em;"-->
-            <li id="{$id}">
+         <li>
+               <xsl:if test="$id = $currentid">
+                 <xsl:attribute name="id">webhelp-currentid</xsl:attribute>
+               </xsl:if>               
                 <span class="file">
                     <a href="{substring-after($href,concat($frameset.base.dir,'/content/'))}">
                         <xsl:value-of select="$title"/>
                     <ul>
                         <xsl:apply-templates
                                 select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv"
-                                mode="webhelptoc"/>
+                                mode="webhelptoc">
+                                       <xsl:with-param name="currentid" select="$currentid"/>
+                       </xsl:apply-templates>
                     </ul>
                 </xsl:if>
             </li>