You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Goetz Botterweck <bo...@uni-koblenz.de> on 2003/02/25 18:01:20 UTC

Sitemap, process depending on existence of files

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 Botterweck

Institute for IS Research
University of Koblenz-Landau
Universitaetsstrasse 1
D-56070 Koblenz
Germany

Phone:     +49 261 2872531
Email:   botterwe@uni-koblenz.de



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Sitemap, process depending on existence of files

Posted by Miles Egan <mi...@caddr.com>.
Tony Collen wrote:
> 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>

Have you tried the resource-exists action?


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Sitemap, process depending on existence of files

Posted by Tony Collen <tc...@neuagency.com>.
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}&amp;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: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org