You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Christian Roth <ro...@visualclick.de> on 2004/10/05 14:27:55 UTC

Tab-menu generation problem

Hi,

I asked this several days ago, but neither have found the reason for the
unexpected behaviour nor a solution, so I'm asking again in the hope
someone can shed some light on this.

I have the problem that no menu under a specific tab is generated. I'm
using forrest_20041005044633, snapshot from Tue, Oct 5, 2004. Here's my 

site.xml:
---------

<site label="infinity-loop" href="" 
  xmlns="http://apache.org/forrest/linkmap/1.0" tab="">

    <index label="Profile" href="company/index.html" tab="company"/>
    <contact label="Contact" href="company/contact.html" tab="company" />

</site>

and my

tabs.xml:
---------

<tabs software="MyProj"
  title="MyProj"
  copyright="Foo"
  xmlns:xlink="http://www.w3.org/1999/xlink">

  <tab id="company" label="Company" dir="company" indexfile="index.html"/>
</tabs>


I have source index.xml and contact.xml files available under xdocs/
company/, and they get generated correctly, just not the menu consisting
of what I think should contain

  Profile
  Contact

under the Company tab which itself is generated and highlighted correctly
when I show /company/index.html in my browser. Why does the menu not get
generated?

Regards, Christian.






Re: Tab-menu generation problem

Posted by Christian Roth <ro...@visualclick.de>.
Ross Gardler wrote:

>> How can I add entries to a tab's menu that are top-level and not
>> grouping, i.e. a simple flat menu?
>
>If the skin provided is not doing what you need then the solution is to 
>customise the skin, currently none of the shipped skins have this 
>feature implemented.

Thanks Ross. However, modifying the skin was not enough, it actually was
an issue of some 10 characters in the distribution's ~/core/context/
resources/stylesheets/site2book.xsl which delivered an empty "menu-*"
component, so the skin could not do much here.

When I get the time, I'll suggest/submit it as improvement over on the
dev list, as it doesn't seem to break anything else (so far).

--snip (for those who need it)--
...

  <xsl:template match="*/*">
    <xsl:choose>
      <!-- No label, abandon the whole subtree -->
      <xsl:when test="count(descendant-or-self::*[@label])=0"> <!--
###changed rC 2004-10-08### -->
      </xsl:when>
      <!-- Below here, everything has a label, and is therefore
considered "for display" -->

...
--snip--

Christian



Re: Tab-menu generation problem

Posted by Ross Gardler <rg...@apache.org>.
Christian Roth wrote:
> Ross Gardler wrote:
> 
> 
>>Christian Roth wrote:
>>
>>>site.xml:
>>>---------
>>>
>>><site label="infinity-loop" href="" 
>>>  xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
>>>
>>>    <index label="Profile" href="company/index.html" tab="company"/>
>>>    <contact label="Contact" href="company/contact.html" tab="company" />
>>>
>>></site>
>>
>>The menu for each section is created from the elements within each 
>>element in the site.xml, they are not grouped by the tab attribute (see 
>>http://forrest.apache.org/docs/linking.html#site). You need to create a 
>>parent object for the pages in the company tab
> 
> 
> The documentation says: 
> 
> "All site.xml entries with a "tab" which is equal to that of the current
> page, are added to the menu."
> 
> I read this meaning that the above <index> and <contact> elements are
> entries of site.xml, and since they have the same tab attribute value
> like the page currently displayed (company/index.html), these two entries
> should show up in the menu.

Yes, this is a potentially misleading sentence. I'll fix in the docs now 
- thanks for pointing this out.

> Your solution:
> 
> 
>><site label="infinity-loop" href=""
>>   xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
>>
>> <company label="Company" href="company" tab="company">
>>   <profile label="Profile" href="index.html"/>
>>   <contact label="Contact" href="contact.html"/>
>> </company>
>></site>
> 
> 
> does work, but generates a "Company" grouping label in the menu, which is
> redundant since the tab already is labelled "Company" and there are no
> further top-level categories in that menu other than "Company". I wanted
> to get rid of this redundant grouping.

That is the intended behaviour, it may be redundant in your use case, 
but in many others it is not, since each tap will have multiple sections 
in the menu, or where site developers want plenty of visual clues as to 
the current position within the site.

<snip/>

> How can I add entries to a tab's menu that are top-level and not
> grouping, i.e. a simple flat menu?

If the skin provided is not doing what you need then the solution is to 
customise the skin, currently none of the shipped skins have this 
feature implemented. You will find the menu generation stuff in 
src/context/skins/[skinname]/xslt/html/site2html.xsl. By default the 
skinname is "pelt".

If you are unable to make this change you could post a feature request 
on our issue tracker 
http://issues.cocoondev.org/secure/BrowseProject.jspa?id=10000 (this 
will make other devs aware of it too, just in case there is a way I am 
not aware of). Similarly, if you implement this in a configurable way 
please post a patch to the tracker.

Ross

Re: Tab-menu generation problem

Posted by Christian Roth <ro...@visualclick.de>.
Ross Gardler wrote:

>Christian Roth wrote:
>> site.xml:
>> ---------
>> 
>> <site label="infinity-loop" href="" 
>>   xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
>> 
>>     <index label="Profile" href="company/index.html" tab="company"/>
>>     <contact label="Contact" href="company/contact.html" tab="company" />
>> 
>> </site>
>
>The menu for each section is created from the elements within each 
>element in the site.xml, they are not grouped by the tab attribute (see 
>http://forrest.apache.org/docs/linking.html#site). You need to create a 
>parent object for the pages in the company tab

The documentation says: 

"All site.xml entries with a "tab" which is equal to that of the current
page, are added to the menu."

I read this meaning that the above <index> and <contact> elements are
entries of site.xml, and since they have the same tab attribute value
like the page currently displayed (company/index.html), these two entries
should show up in the menu.

Your solution:

><site label="infinity-loop" href=""
>    xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
>
>  <company label="Company" href="company" tab="company">
>    <profile label="Profile" href="index.html"/>
>    <contact label="Contact" href="contact.html"/>
>  </company>
></site>

does work, but generates a "Company" grouping label in the menu, which is
redundant since the tab already is labelled "Company" and there are no
further top-level categories in that menu other than "Company". I wanted
to get rid of this redundant grouping.

So I tried omitting the label to not get the grouping header in the menu:

--snip--
  <company href="company/" tab="company">
    <profile label="Profile" href="index.html"/>
    <contact label="Contact" href="contact.html"/>
  </company>
--snip--

But then, the complete menu is once again not generated at all because of
the "Elements without label attributes (and their children) are not
displayed in the menu." rule.

How can I add entries to a tab's menu that are top-level and not
grouping, i.e. a simple flat menu?

Regards, Christian.


Re: Tab-menu generation problem

Posted by Ross Gardler <rg...@apache.org>.
Christian Roth wrote:
> site.xml:
> ---------
> 
> <site label="infinity-loop" href="" 
>   xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
> 
>     <index label="Profile" href="company/index.html" tab="company"/>
>     <contact label="Contact" href="company/contact.html" tab="company" />
> 
> </site>

<snip/>

> I have source index.xml and contact.xml files available under xdocs/
> company/, and they get generated correctly, just not the menu consisting
> of what I think should contain
> 
>   Profile
>   Contact
> 
> under the Company tab which itself is generated and highlighted correctly
> when I show /company/index.html in my browser. Why does the menu not get
> generated?

The menu for each section is created from the elements within each 
element in the site.xml, they are not grouped by the tab attribute (see 
http://forrest.apache.org/docs/linking.html#site). You need to create a 
parent object for the pages in the company tab:

<site label="infinity-loop" href=""
    xmlns="http://apache.org/forrest/linkmap/1.0" tab="">

  <company label="Company" href="company" tab="company">
    <profile label="Profile" href="index.html"/>
    <contact label="Contact" href="contact.html"/>
  </company>
</site>


Ross