cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Schmidt <>
Subject RE: Trigger Cocoon http response code from within XSL code
Date Mon, 16 Dec 2013 10:31:03 GMT
Hi David,

> Just in case you have not seen it, and to add more connections info to the mail archives:
> Some of that is old, but there is a good thread linked in the section about Cocoon 2.1
that is relevant:
> Subject: Generators now allowed in <map:handle-errors>

Thank you very much for the links provided.

I was able to make it work. Here is the code for throwing individual exceptions from within
XSLT to the cocoon sitemap:

  <map:selector name="exception" src="org.apache.cocoon.selection.XPathExceptionSelector">
    <exception name="FileNotFound" class="org.apache.cocoon.ResourceNotFoundException"/>
    <exception name="Transform" class="javax.xml.transform.TransformerException" unroll="true">
      <xpath name="ContentNotAvailableInCountry" test="message='ContentNotAvailableInCountry'"/>
    <exception class="java.lang.Throwable" unroll="true"/>
  <map:select type="exception">
    <map:when test="ContentNotAvailableInCountry">
      <!-- defined <xsl:message terminate="yes">ContentNotAvailableInCountry</xsl:message>
error -->
    <map:when test="Transform">
      <!-- generic <xsl:message terminate="yes"/> error -->
    <map:when test="FileNotFound">
      <!-- file not found error -->
      <!-- something else -->

This works for me. The key is to have the unroll="true" in it + the order of the <exceptions/>.

I will do further testing.


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

View raw message