cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Curran <>
Subject Re: Return Error Code Based on Pipeline Content
Date Tue, 11 Apr 2006 12:08:49 GMT
Since I need to make a choice between a number of different exceptions 
to throw I used a xalan java extension, and then an exception selector 
in the handle-errors section.

This did the trick. In the transform I have defined 
<exception:statusCode200/> which will cause Java to throw a 
StatusCode200Exception which I can pick up in the handle-errors section 
and return <map:serialize type="xml" status-code="200"/>

Using the java extension allows me to easily define which error code 
that I wish to throw and to pick based on an xsl:if or xsl:choose.

Thanks for the advice, it worked out great,

Joerg Heinicke wrote:
> On 10.04.2006 08:34, Bertrand Delacretaz wrote:
>> I don't think there is a standard way of throwing Exceptions from 
>> XSLT code, but calling a small Java extension class from XSLT to 
>> throw the Exception should do the trick, if you need to do this from 
>> XSLT.
> I could not read from his message that he needs exceptions from XSLT, 
> but there is an easy solution for it: <xsl:message terminate="yes"/>.
> Regards,
> Jörg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message