[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|