I haven't tried this with Xalan, and the behavior is very processor
specific, but one idea is to try:

<xsl:message terminate="yes">404 Resource Not Found.</xsl:message>

in your stylesheet and then add a handle-errors section in your pipeline
with a serializer that sets the status-code="404". The unknown is how
Xalan handles the terminate="yes" attribute. If I recall correctly, Xalan
handles this by throwing an exception, which should bubble up and be
handled by the Cocoon error handler.

The suggestion by Liam is cleaner in that it is less
transformer specific, but I just thought I'd throw this out there as
quick and dirty option :)

Regards,

--mike

On Mon, 8 Apr 2002, Liam Morley wrote:

> What you might do (and this is just one approach) is to write a
> java transformer that will verify that the file exists, and if it doesn't,
> throw a ResourceNotFoundException(). Then, if it does exist, pass the SAX
> information on to the XSLT transformer. By that time, you don't have to
> worry whether or not you'll find it or not. Or (and I'm not sure about
> this) write a transformer that simply extends TraxTransformer, and
> overwrite the setup() method. From here, you can check parameters passed
> from the sitemap. You wouldn't have to overwrite any other code.
>
> Liam Morley
>
>
> On Mon, 8 Apr 2002, Sylvain Fétiveau wrote:
>
> > Hi,
> >
> > When someone requests an URL like /glossary/*.html, I use a single XML
> > file for all the glossaries + an XSL file to transform it (I pass the
> > filename of the glossary page to the XSL transformer). Sometimes, an
> > unexisting page is requested (i.e. a page which is not listed in my
> > large XML file). Is there a way to "fire" something to make cocoon
> > consider this request as an error 404, which will be then handled ? As
> > long as I handle the 404 errors, I guess that it's not a real problem if
> > I already outputed some content when I "fire" my error... Or maybe I
> > should write a Xalan extension to redirect the user to my error 404
> > page...
> >
> > Thank you in advance.
> >
> > --
> > °v° Sylvain Fétiveau   Tel. (613) 731-4046
> > / \ Webmotion Inc.     http://www.webmotion.com
> > " " mailto:[EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > 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]>
> >
> >
>
>
> ---------------------------------------------------------------------
> 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]>
>


---------------------------------------------------------------------
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