I think that you assume that cocoon:/directory/../_navigation.xml should
be
contracted to cocoon:/_navigation.xml and therefore match the first
pattern.

(Cocoon doesn't do this contraction for the good reason that /foo/bar/..
is not the same as /foo if /foo/bar is a symbolic link.)

So what is that the redirect-to matches the second pattern as 
directory/../_navigation.xml, then as directory/../../_navigation.xml
in an infinite recursion.

What you need to do, is to have three patterns:

<map:match pattern="_navigation.xml">
 <map:generate src="{defaults:content}/_null-navigation.xml"/>
 <map:serialize type="xml"/>
</map:match>

<map:match pattern="*/_navigation.xml">
 <map:act type="resource-exists">
  <map:parameter name="url"
value="{defaults:content}/{1}/_navigation.xml"/>
  <map:generate src="{defaults:content}/{../1}/_navigation.xml"/>
  <map:transform src="{defaults:design}/nav2xhtml.xsl"/>
  <map:serialize type="xml"/>
 </map:act>
 <map:redirect-to uri="cocoon:/_navigation.xml"/>
</map:match>

<map:match pattern="**/*/_navigation.xml">
 <map:act type="resource-exists">
  <map:parameter name="url"
value="{defaults:content}/{1}/{2}/_navigation.xml"/>
  <map:generate src="{defaults:content}/{../1}/{../2}/_navigation.xml"/>
  <map:transform src="{defaults:design}/nav2xhtml.xsl"/>
  <map:serialize type="xml"/>
 </map:act>
 <map:redirect-to uri="cocoon:/{1}/_navigation.xml"/>
</map:match>

This duplication of code may make you shudder too much.  I'm sure there
are
also more elegant solutions using a regexp matcher or map:call.  But it
will hardly require less lines.

HTH, Alfred.

-----Original Message-----
From: Ben Young [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 25. Februar 2003 19:49
To: [EMAIL PROTECTED]
Subject: map:redirect's never return...


I have built a "looping" matcher in my root sitemap.xmap.

<map:match pattern="_navigation.xml">
 <map:generate src="{defaults:content}/_null-navigation.xml"/>
 <map:serialize type="xml"/>
</map:match>

<map:match pattern="**/_navigation.xml">
 <map:act type="resource-exists">
  <map:parameter name="url"
value="{defaults:content}/{1}/_navigation.xml"/>
  <map:generate src="{defaults:content}/{../1}/_navigation.xml"/>
  <map:transform src="{defaults:design}/nav2xhtml.xsl"/>
  <map:serialize type="xml"/>
 </map:act>
 <map:redirect-to uri="cocoon:/{1}/../_navigation.xml"/>
</map:match>

These matchers let you select part of use the cocoon:// psuedo-protocol
to
select the nearest _navigation.xml file. This allows the page to
"inherit"
the navigation from one of it's predecessors.

This works fine so long as I request it from the root sitemap (e.g.,
"cocoon:/"). If I request the _navigation.xml from a sub-sitemap, I get
a
StackOverflow error. It's almost as if the lopping some how changes the
context to the point that it never returns to the sub-sitemap.
Requesting a
cocoon:/directory/_navigation.xml in a cinclude tag cause the same sort
of
error.

Thanks for your help in advance,
Ben


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to