cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter van Hardenberg <...@uvic.ca>
Subject Cocoon exception handling.
Date Tue, 11 Oct 2005 06:16:22 GMT
Hello,

I'm using a secondary data-driven XSLT to provide annotations for my document 
pages (thanks, Conal) but when the annotations are not present, it throws an 
exception which kills the pipeline. 

Now, I thought the best way to deal with that would be to handle the exception 
in the annotation pipeline, detect when the file is missing and simply return 
an ID transform instead of one that does something.

Unfortunately, I can't get it to work at all. I simply can't get the 
"identity.xslt" to ever get returned! I would be very appreciative of any 
advice you guys can give.

Thanks in advance,

Peter van Hardenberg
University of Victoria, Canada

<!--- bits of my sitemap follow -->
    <map:generators default="file">
      <map:generator name="exception" 
src="org.apache.cocoon.samples.errorhandling.ExceptionGenerator"/>
    </map:generators>
    <map:selectors default="browser">
      <map:selector name="exception" 
src="org.apache.cocoon.selection.XPathExceptionSelector">
        <exception name="validation" 
class="org.apache.cocoon.samples.errorhandling.ValidationException"/>
        <exception name="not-found" 
class="org.apache.cocoon.ResourceNotFoundException"/>
        <exception name="missing-source" 
class="java.io.FileNotFoundException"/>
        <exception class="java.lang.Throwable" unroll="true"/>
      </map:selector>
    </map:selectors>
    <map:actions>
      <map:action name="exception" 
src="org.apache.cocoon.samples.errorhandling.ExceptionAction"/>
    </map:actions>
  </map:components>

   <!-- annotations stylesheet creation -->
   <map:pipeline>
    <map:match pattern="annotate/*"> 
	 <map:generate src="content/{1}_ann.xml"/>
         <map:transform type="xslt-saxon" 
src="style/annotations-to-stylesheet.xslt"/>
         <map:serialize type="xml"/>
    </map:match>
    <map:handle-errors>
      <map:select type="exception">
        <map:when test="missing-source">
         <!-- in the event of an emergency (no annotations), just return the 
identity transform -->
 	 <map:generate src="style/identity.xslt"/>
 	 <map:serialize type="xml"/>
	</map:when>
      </map:select>
    </map:handle-errors>
   </map:pipeline>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message