You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Lorenz Froihofer <Lo...@gmx.at> on 2004/05/13 15:49:58 UTC
[PATCH] normalize hrefs in site before selecting entries for tab
Hi,
following issue:
My site.xml contains something similar to:
<site>
<category1 tab="tab-1" href="category1/" label="Category 1">
<entry1 label="My Entry 1" href="entry1/index.html" />
<entry2 label="My Entry 2" href="../entry2/index.html" />
...
All entries should correspond to the tab "tab-1". During pipeline
processing the hrefs of the entries are translated to
href="category1/entry1/index.html" for entry 1
href="category1/../entry2/index.html" for entry 2
In resources/stylesheets/site2site-selectnodes.xsl a path comparison is
performed for incomming requests by using the starts-with() method.
The issue is now that an incomming request for entry2 is
"entry2/index.html" but the entry in the site.xml during processing is
"category1/../entry2/index.html". Therefore, the comparison fails with
the result that for entry 2 the content of all available tabs is shown
in the menu.
To resolve this issue, I suggest to normalize the href-attributes before
calling "site2site-selectnodes.xsl". This can be achieved by copying the
attached normalizehrefs.xsl to the "resources/stylesheets" directory
and applying the patch to "context/menu.xmap".
The patch adds one line to menu.xmap:
<map:transform src="resources/stylesheets/normalizehrefs.xsl" />
After this, the href attribute of entry2 in the example above is
normalized to "entry2/index.html" and the comparison by using the
starts-with() function succeeds.
Kind regards,
Lorenz Froihofer.
Re: [PATCH] normalize hrefs in site before selecting entries for
tab
Posted by Lorenz Froihofer <Lo...@gmx.at>.
Latest SVN version still has the same behaviour. The issue is that the
incoming request path is compared to the specified path in the site.xml.
As the path in the site.xml is not normalized, the starts-with
comparison fails and the menu entries for all tabs are shown.
Try the following setup:
<site>
<category1 tab="tab-1" href="category1/" label="Category 1">
<entry1 label="My Entry 1" href="entry1.html" />
<entry2 label="My Entry 2" href="../dir-entry2/entry2.html" />
</category1>
<category2 tab="tab-2" href="category2/" label="Category 2">
<entry3 label="My Entry 3" href="dir-entry3/entry2.html />
</category3>
</site>
A request to entry1.html shows the menu corresponding to tab-1. A
request to entry3.html shows the menu corresponding to tab-2. But: a
request to entry2.html show the menus of tab-1 and tab-2.
The reason is that entry2.html has at the time of comparison in
resources/stylesheets/site2site-selectnodes.xsl the value
"category1/../dir-entry2/entry2.html" which is different to the
incomming request to "dir-entry2/entry2.html". Therefore, the comparison
by using the starts-with() function fails and it cannot be found that
entry2.html belongs to tab "tab-1".
-- Lorenz.
Juan Jose Pablos wrote:
> Lorenz Froihofer escribió:
>
>> By the way, the menu.xmap patch was applied to the version contained
>> in the 0.5.1 release.
>
>
> I have not been able to reproduce this error on our latest release.
> Would it be possible to test your setup with todays SVN version?
>
>
> http://xml.apache.org/forrest/build.html
>
>
>
Re: [PATCH] normalize hrefs in site before selecting entries for
tab
Posted by Juan Jose Pablos <ch...@che-che.com>.
Lorenz Froihofer escribió:
> By the way, the menu.xmap patch was applied to the version contained in
> the 0.5.1 release.
I have not been able to reproduce this error on our latest release.
Would it be possible to test your setup with todays SVN version?
http://xml.apache.org/forrest/build.html
Re: [PATCH] normalize hrefs in site before selecting entries for
tab
Posted by Lorenz Froihofer <Lo...@gmx.at>.
By the way, the menu.xmap patch was applied to the version contained in
the 0.5.1 release.