Terminating an XSLT transform during processing
I have run into an instance where I need to terminate and raise an exception from within an XSLT template, based on values (or lack thereof) within the source document. The XSLT transform is running within a BizTalk map.
The secret is the following little-known XSLT construct, which can be conditionally called at any point in the transform:
<xsl:message terminate="yes">Custom error text</xsl:message>
This will cause the XSLT engine to stop processing immediately, and raise an exception. This exception, including the custom error text contained within the message segment, can be caught in the BizTalk Orchestration engine by explicitly catching an exception of type Microsoft.XLANGS.BaseTypes.TransformationFailureException.
No comments yet.
-
Archives
- April 2015 (1)
- July 2013 (1)
- May 2013 (2)
- March 2013 (1)
- February 2013 (1)
- January 2013 (1)
- December 2012 (1)
- November 2012 (1)
- October 2012 (1)
- September 2012 (2)
- July 2012 (2)
- June 2012 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS
Leave a comment