Class XsltErrorUtils


  • public class XsltErrorUtils
    extends java.lang.Object
    This class provides a range of static XSLT utility methods for error handling.
    Author:
    Ikasan Development Team
    • Constructor Summary

      Constructors 
      Constructor Description
      XsltErrorUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void throwException​(java.lang.String message)
      Throws an Exception with the specified detail message.
      static void throwTrivialException​(java.lang.String message)
      Utility method for handling XSLT errors that we dont want to stop things
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XsltErrorUtils

        public XsltErrorUtils()
    • Method Detail

      • throwException

        public static void throwException​(java.lang.String message)
                                   throws javax.xml.transform.TransformerException
        Throws an Exception with the specified detail message. *
         # =============================================
         #    Stylesheet for throwException()
         # =============================================
         <?xml version="1.0"?>
         <xsl:stylesheet
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:xalan="http://xml.apache.org/xslt"
           xmlns:error="xalan://org.ikasan.framework.component.xslt.util.XsltErrorUtils"
           version="1.0"
           exclude-result-prefixes="xalan error">
         
         <xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>
         
         <xsl:template match="/">
           <xsl:element name="xyz">
             <xsl:element name="newElement">
               <xsl:choose>
                 <xsl:when test="/root/data[1]/j">
                   <xsl:value-of select ="/root/data[1]/j"/>
                 </xsl:when>
                 <xsl:otherwise>
                   <xsl:value-of select ="error:throwException('Element /root/data[1]/j not found.')"/>
                 </xsl:otherwise>
               </xsl:choose>
             </xsl:element>
           </xsl:element>
         </xsl:template>
         
         </xsl:stylesheet>
         
        Parameters:
        message - is the detail message.
        Throws:
        javax.xml.transform.TransformerException
      • throwTrivialException

        public static void throwTrivialException​(java.lang.String message)
                                          throws javax.xml.transform.TransformerException
        Utility method for handling XSLT errors that we dont want to stop things
        Parameters:
        message -
        Throws:
        javax.xml.transform.TransformerException