On Tue, 25 Feb 2003, Goetz Botterweck wrote:
> Is it possible to write sitemap rules which check for the existence of
> files?
>
> Somewhat like
>
> <map:match pattern="path/*.html">
> if "docs/path/{1}.xml" exists then
> <map:generate src="docs/path/{1}A.xml"/>
>
> <map:transform src="tranformation-a.xsl"/>
> else
> <map:generate src="docs/path/{1}B.xml"/>
>
> <map:transform src="transformation-b.xsl"/>
> end if
> <map:serialize type="xhtml-transitional"/>
> </map:match>
>
> Thx for any hints
Goetz,
I'm not sure, but I'm thinking you could get creative with the
<map:handle-errors/> element and call different pipelines depending on the
error. I was encountering this sort of problem (although not exactly the
same) when I had something like this setup:
<map:match pattern="blah/*/*/">
<map:generate src="http://server/script?foo={1}&bar={2}"/>
<map:transform src="stylesheets/script2html.xsl"/>
<map:serialize type="xhtml"/>
</map:match>
The problem was the script wouldn't always return data, and I'd have to
come up with some special way of knowing that. Unfortunately, I didn't
have control of the output of the remote server, so there was no ay to
embed extra error information in the returned data.
Something like a try/catch in the sitemap would be interesting :) If a
generator or transformer or serializer fails, you'll have something to
back you up, like generating a decent "oops" page instead of having a
giant Cocoon stacktrace appear to the user.
I might try to play with my idea of creatively using the map:handle-errors
tag and see if I can get something working.
Regards
Tony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]