[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Is there a way to catch Exceptions in xslt thrown from

Subject: Is there a way to catch Exceptions in xslt thrown from calling a Java function within Xalan ?
From: Bill Riegel <BRiegel@xxxxxxx>
Date: Fri, 27 Feb 2004 12:58:42 -0600
xsl exceptions

Have the template below that I use with Xalan. 
Its purpose is to read a date string in one format and convert to another
format. But if/when the input data does not match the input format an
exception is thrown and the entire translation stops. Is there a way to
catch the exception ?  

  <xsl:template name="dateReformatter"
xmlns:java="http://xml.apache.org/xslt/java">
     <xsl:param name="inputDate"/>
     <xsl:param name="inputFormat" />
     <xsl:param name="outputFormat"/>
     <xsl:message>in date</xsl:message>

    <xsl:choose>
    <xsl:when test="function-available(
'java:java.text.SimpleDateFormat.parse' )">
    <xsl:message>doing date</xsl:message>
    <xsl:variable name="informatter"       
        select="java:java.text.SimpleDateFormat.new($inputFormat)"/>

    <xsl:variable name="date"       
        select="java:parse($informatter, $inputDate)"/>

    <xsl:variable name="outformatter"       
        select="java:java.text.SimpleDateFormat.new( $outputFormat )"/>

    <xsl:variable name="outdate"       
        select="java:format($outformatter, $date)"/>

    <xsl:value-of select="$outdate"/>
    </xsl:when>
    <xsl:otherwise>
         No Date
    </xsl:otherwise>
    </xsl:choose>
 </xsl:template>


Bill Riegel
LandMark Graphics
713-839-3388



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.