From: "Simeon Walker" <[EMAIL PROTECTED]>

> Hi,
>      I am having trouble handling ResourceNotFound errors in my
> sub-sitemaps. My main sitemap just deals with aggregation, stylesheet
> selection and transformation to html. The sub-sitemaps define
> the production xml.
>
> If I request a page that does not exist the top level sitemap
> won't handle the error (I think) since there are matches for ** and
> **/ which request content from sub-sitemaps. If the requested file
> does not exist I can see the exception in the logs but no error
> handler is called. I simply get my page/menus etc with blank
> content.

The top sitemap *should* handle the error and IIRC it did, but I had to make
the reference to the stylesheet in the root sitemap be resolved with
context:// .
AFAIK the subsitemap uses the first available parent sitemap handle-errors
resolving relative to its own context.

> I have tried serializing xml from the sub-sitemap error handler
> so that the root sitemap could transform this and produce a readable
> message. But, I am correct in thinking this is not allowed?

You should declare the handle-errors in the sub sitemap and handle them
there, or leave it all to the root sitemap.

> Perhaps I could use the resource-exists action in the sub-sitemaps?
> I can't find an example of this anywhere. I can get it to work in
> the case where the file exists but what happens when it doesn't?
>
> <map:match pattern="**.xml">
>    <map:act type="lang-select">
>      <map:act type="resource-exists" url="{../1}_{lang}.xml">
>        <map:generate src="{../../1}_{../lang}.xml"/>
>      </map:act>
>    </map:act>
>    <map:serialize type="xml"/>
> </map:match>
>
> In this example, how can I send something else back when the
> resource does not exist?

As with all actions, when the action fails, it continues processing outside
of itself.
This is how it could work:

 <map:match pattern="**.xml">
    <map:act type="lang-select">
      <map:act type="resource-exists" url="{../1}_{lang}.xml">
        <!--if it doesn't fail, it executes what's in here -->
        <map:generate src="{../../1}_{../lang}.xml"/>
        <map:serialize type="xml"/>
      </map:act>
    </map:act>
    <!--if it fails, it executes what's here -->
    <map:generate src="failerrormessage.xml"/>
    <map:serialize type="xml"/>
 </map:match>

--
Nicola Ken Barozzi                   [EMAIL PROTECTED]
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to