You could also use the resource exists action in the included
pipeline to include an empty document if the resource is not
found.

Also, if you are doing this with several documents, you could
generate the cinclude elements dynamically based on the presence
of the files.  For this you could start with the directory
generator, or just do it manually in an xsp, etc.

HTH,
Geoff

> -----Original Message-----
> From: Michael Riedel [mailto:[EMAIL PROTECTED]
> Sent: Sunday, June 15, 2003 6:42 AM
> To: [EMAIL PROTECTED]
> Subject: Re: conditional cincludes?
>
>
> > How do I check for the instance of a file before
> > attempting to cinclude it?  Basically, I don't
> > want the pipeline to die if the file isn't found.
>
> If that's the only thing you need, maybe the following use of the cinclude
> tag might help:
>
> <cinclude:includexml ignoreErrors="true">
>     <cinclude:src>foo/bar.xml</cinclude:src>
> </cinclude:includexml>
>
> I found it in the documentation
> (http://cocoon.apache.org/2.1/userdocs/transformers/cinclude-trans
> former.htm
> l), but have not tried it myself yet.
>
> If there are other criteria for use cinclude or not, you might insert an
> XSLT-transformer before the CInclude-Transformer. The XSLT might then add
> the cinclude tags only under certrain conditions.
>
> -- Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


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

Reply via email to