forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <>
Subject Re: Site.xml questions.
Date Wed, 26 Feb 2003 16:06:44 GMT
On Tue, Feb 25, 2003 at 04:33:16PM -0500, Berin Loritsch wrote:
> The site.xml is too abstract for me to get my head around.  I need some
> help understanding how the site.xml relates to the menus for tabs.

The HTML is quite deceptive: as you say, it looks like each menu belongs
to a tab.  Actually, tabs are completely optional, passive things.  They
simply react to the current path.  If the tab's path is the longest one
that matches the current page path, then that tab is "on".

IOW, don't worry about tabs until you're happy with your site menu.

> I have the enclosed site.xml and tabs.xml files, but when I generate my
> site, I get nothing in the menu for the tabs.
> Also, I find it anoying that the full Site.xml menu is rendered for the
> first level pages.  Is there any way to suppress that behavior?

Not without sitemap hacking.  Yours is a common need though, so we'll
have to parametrize this sooner or later.

There are two options:

1) Just use book.xml files.  This isn't as bad as it sounds, because you
can use 'site:' links in book.xml:

<menu-item label="Overview" href="site:howto-samples/overview"/>

so you don't have to manually add/delete the ..'s when synching book.xml

2) Make a 1-line addition to the sitemap.

Here is the relevant pipeline (line 539) which selects the subset of
site.xml to render:

         <map:match pattern="abs-linkmap/**">
            <map:generate src="cocoon:/abs-linkmap" />

            <map:transform type="xpath">
               <map:parameter name="include" value="//*[@href='{1}']" />

            <map:serialize type="xml" />

Here, {1} matches the current relative directory path.  The "abs-linkmap"
pipeline serves up a site.xml with absolute paths.  The "xpath"
transformer selects only the node with a matching href path.

To limit the tree, we can provide an "exclude" parameter to the xpath

        <map:transform type="xpath">
           <map:parameter name="include" value="//*[@href='{1}']" />
           <map:parameter name="exclude" value="//*[@href='{1}']/*/*/*/*" />

Through trial and error, I found that eliminates the listing of sub-menu

It's a pity that menu titles aren't clickable links, or we could prune
one step further up the menu tree.


View raw message