forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <>
Subject [PATCH] fix tabs
Date Tue, 10 Sep 2002 06:52:16 GMT

This patch fixes tabs on Forrest-based websites. In the current
tab2menu.xsl, there is a hardcoded '/forrest' context path:

<a href="/forrest/{@dir}">

Which a) makes tab2menu.xsl unusable for non-Forrest sites, and b) forces
the Forrest context to be '/forrest'. Also because it's trying to be
server-relative, the links are broken on static local docs: they appear
as file:///forrest/community/howto/index.html

My fix is to make the generated link relative. As the link must be
relative to the current directory, I've written an XSL, dotdots.xsl,
which returns the appropriate number of ../'s to negate the current tab's
directories. From the file's description. Here's the examples:

  Input                           Output 
    index.html                    ""
    dir/index.html                "../"
    dir/subdir/index.html         "../../"
    dir//index.html              "../"
    dir/                          "../"
    dir//                         "../"
    \some\windows\path            "../../"
    \some\windows\path\           "../../../"
    \Program Files\mydir          "../"

Anyway, it's used in tab2menu.xsl to work out the correct links for
non-selected tabs. So if the user is in community/howto/index.html, the
'Home' link goes to ../../

I have also modified the sitemap to allow linking to directories. Links
to '**/' are now redirected to '**/index.html'. Without this, tabs were
broken in the live webapp, since each tab is a directory link. Statically
generated sites worked because (presumably) the crawler rewrites links to
'directory/' to 'directory/index.html'.

Also, previously directories in tabs.xml had to end in '/':

  <tab label="Home" dir=""/>
  <tab label="How-Tos" dir="community/howto/"/>
  <tab label="XML Site" dir="xml-site/"/>

Now tab2menu.xsl adds a trailing '/' regardless, so it is no longer
required (although it won't hurt).

I've verified that offline generation works correctly with this patch.
The NPEs, broken links and zillion FOP error messages are not my fault ;)


View raw message