title: Throwing an exception from XSLT
body: <p>I need XSLT to stop processing with an error, when an external document is not available. From what I've found out the &lt;xsl:message&gt; tag seems to be the right way to do it, but so far it doesn't work. Here's what I tried:</p>
  
  <pre><code>&lt;xsl:if test="not(document('some_external_doc.xml')//myxpath)"&gt;
      &lt;xsl:message terminate="yes"&gt;ERROR: Missing element!&lt;/xsl:message&gt;
      &lt;h1&gt;Error detected!&lt;/h1&gt;
  &lt;/xsl:if&gt;
  </code></pre>
  
  <p>The missing document/xpath is detected by the &lt;xsl:if&gt; and the &lt;h1&gt; will be displayed, but for some reason the terminate attribute of the &lt;xsl:message&gt; is ignored. The transformation is done in Railo, so the XSLT processor use should be the Java default, but I wasn't able to find something definitive about the processor Railo is using.</p>