XSLT exception handling


XML & Web services: XSLT exception handling

  1. XSLT exception handling (3 messages)

    We test a particular constriant in our XSLT and throw a custom exception on failure: Here exception is defined as: xmlns:exception="http://..../util.exception.ValidationExceptionThrower" The problem is that this kind of exception handling by-passes the java code. In our Java client,we have the following: { ......... TransformerFactory tFactory = TransformerFactory.newInstance(); transformer = tFactory.newTransformer(source); .... StreamResult result = new StreamResult(); java.io.ByteArrayOutputStream outputXmlResult = new java.io.ByteArrayOutputStream(); result.setOutputStream(outputXmlResult); transformer.transform(xmlsource, result); setOutXml(outputXmlResult.toString()); return "Success"; } catch(ValidationException ex) { System.out.println("INSIDE VALIDATIONEXCEPTION"); ...... } finally { return "failure"; } } The exception thrown by XSLT does not get trapped by the error handler in the client. How can XSLT be adapted to throw a 'catchable' exception.

    Threaded Messages (3)

  2. I have tried this myself, but since the Transformer#transform method can throw a TransformerException, have you tried throwing one of those instead? Cheers, Tony.
  3. That was a typo![ Go to top ]

    I meant to type "I have *not* tried this myself ..." Sorry, Tony.
  4. Is there a solution?[ Go to top ]

    I'm experiencing the same issue...Have you found a solution for this? Thanks, Jacky