Hi David,

> Just in case you have not seen it, and to add more connections info to the 
> mail archives:
> http://wiki.apache.org/cocoon/ErrorHandling
> 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>
> http://marc.info/?l=xml-cocoon-dev&m=104923290631009

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:selectors>
  <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>
    <exception class="java.lang.Throwable" unroll="true"/>
  </map:selector>
</map:selectors>
...
<map:handle-errors>
  <map:select type="exception">
    <map:when test="ContentNotAvailableInCountry">
      <!-- defined <xsl:message 
terminate="yes">ContentNotAvailableInCountry</xsl:message> error -->
    </map:when>
    <map:when test="Transform">
      <!-- generic <xsl:message terminate="yes"/> error -->
    </map:when>
    <map:when test="FileNotFound">
      <!-- file not found error -->
    </map:when>
    <map:otherwise>
      <!-- something else -->
    </map:otherwise>
  </map:select>
</map:handle-errors>
...

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

I will do further testing.

Cheers,
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to