org.ikasan.framework.component.transformation.xslt.util
Class XsltErrorUtils

java.lang.Object
  extended by org.ikasan.framework.component.transformation.xslt.util.XsltErrorUtils

public class XsltErrorUtils
extends Object

This class provides a range of static XSLT utility methods for error handling.

Author:
Ikasan Development Team

Constructor Summary
XsltErrorUtils()
           
 
Method Summary
static void throwException(String message)
          Throws an Exception with the specified detail message.
static void throwTrivialException(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(String message)
                           throws 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:
TransformerException

throwTrivialException

public static void throwTrivialException(String message)
                                  throws TrivialTransformerException
Utility method for handling XSLT errors that we dont want to stop things

Parameters:
message -
Throws:
TrivialTransformerException


Copyright © 2007-2012 Ikasan. All Rights Reserved.