Created
March 13, 2012 00:49
-
-
Save avernet/2025806 to your computer and use it in GitHub Desktop.
Using the exception catcher processor in XPL, with Orbeon Forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<p:param name="instance" type="input"/> | |
<p:param name="data" type="output"/> | |
<!-- Using the URL generator, which here will 404 --> | |
<p:processor name="oxf:url-generator"> | |
<p:input name="config"> | |
<config> | |
<url>http://www.google.com/notfound</url> | |
</config> | |
</p:input> | |
<p:output name="data" id="url-data"/> | |
</p:processor> | |
<!-- The exception catcher behaves like the identity processor if there is no exception --> | |
<!-- However if there is an exception, it catches it, and you get a serialized form of the exception --> | |
<p:processor name="oxf:exception-catcher"> | |
<p:input name="data" href="#url-data"/> | |
<p:output name="data" id="url-data-checked"/> | |
</p:processor> | |
<!-- Check whether we had an exception --> | |
<p:choose href="#url-data-checked"> | |
<p:when test="/exceptions"> | |
<!-- Extract the message --> | |
<p:processor name="oxf:xslt"> | |
<p:input name="data" href="#url-data-checked"/> | |
<p:input name="config"> | |
<message xsl:version="2.0"> | |
<xsl:value-of select="/exceptions/exception/message"/> | |
</message> | |
</p:input> | |
<p:output name="data" ref="data"/> | |
</p:processor> | |
</p:when> | |
<p:otherwise> | |
<!-- Just return the document --> | |
<p:processor name="oxf:identity"> | |
<p:input name="data" href="#url-data-checked"/> | |
<p:output name="data" ref="data"/> | |
</p:processor> | |
</p:otherwise> | |
</p:choose> | |
</p:config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment