forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mickael Remond <mickael.rem...@erlang-fr.org>
Subject Re: Problem with site.xml and menu for hidden items
Date Fri, 29 Jul 2005 17:25:24 GMT
Ross Gardler wrote:
> Let us know if you get anywhere, a patch would be welcome if you make 
> this work.

Hello again,

Here is how I solved the problem. This is not a perfectly clean hack but 
it works for me ;-)
I used this piece of site.xml code:
       <release type="leaf" label="Release notes" href="releases/"
                description="Latest release notes">
         <index type="hidden" label="Release notes" href="index.html"/>
         <release2 type="hidden" label="Release 0.9.1"
                   href="release_0.9.1.html"/>
         <release1 type="hidden" label="Release 0.9"
                   href="release_0.9.html"/>
       </release>

The "hidden" element are properly placed in the site hierarchy, whereas 
element with no label are ignored.
Then I use the type tag to force the rendering of elements that would be 
considered as menu to menu-item (clickable). The element is thus render 
as a "leaf", while having children element (all are hidden).

And I had to modify the file 
/src/core/context/resources/stylesheets/site2book.xsl to:

   <xsl:template match="*/*">
     <xsl:choose>
       <!-- No label, abandon the whole subtree -->
       <xsl:when test="not(@label)">
       </xsl:when>
       <!-- Below here, everything has a label, and is therefore 
considered "for display" -->

       <!-- No children -> must be a menu item -->
       <!-- Has children, but they are not for display -> menu item -->
       <xsl:when test="count(*) = 0 or count(*) > 0 and (not(*/@label))">
         <menu-item>
           <xsl:copy-of select="@*"/>
         </menu-item>
       </xsl:when>
       <xsl:when test="@type='leaf'">
          <menu-item>
             <xsl:copy-of select="@*"/>
          </menu-item>
       </xsl:when>
       <!-- Anything else is considered a menu -->
       <xsl:otherwise>
         <menu>
           <xsl:copy-of select="@*"/>
           <xsl:apply-templates/>
         </menu>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>

I have only added the "leaf" test, in this piece of code.

On problem remains, that I will solve later: The forced leaf element is 
not rendered as selected when I select it directly. It should not be 
hightlighted when a hidden child is selected however.
An example result is here:
http://www.process-one.net/en/projects/ejabberd/releases/release_0.9.1.html

I will fix that after the vacation break.

Thank you all for your help.

-- 
Mickaël Rémond
  http://www.3pblog.net/

Mime
View raw message