// perform Transformation
if ((xmlSource != null) && (xslSource != null))
{
try
{ // new try ... catch around ctor Update -sc
XSLTProcessor xslprocessor = org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
{
try
{
String contentType = null;
if ((contentType = getContentType(xslprocessor.processStylesheet(xslSource))) != null)
response.setContentType(contentType);
xslprocessor.setQuietConflictWarnings(ourDefaultParameters.isNoCW(request));
xslprocessor.setProblemListener(listener);
if (debug)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XSLTResultTarget outBuffer = new XSLTResultTarget(baos);
setStylesheetParams(xslprocessor, request);
xslprocessor.process(xmlSource, xslSource, outBuffer);
baos.writeTo(response.getOutputStream());
writeLog(listener.getMessage(), response.SC_OK);
}
else
{
setStylesheetParams(xslprocessor, request);
xslprocessor.process(xmlSource, xslSource,
new XSLTResultTarget(response.getWriter()));
}
}
catch (Exception exc)
{
ApplyXSLException axe = new ApplyXSLException("Exception occurred during Transformation:"
+ EOL + listener.getMessage() + EOL
+ exc.getMessage(), exc,
response.SC_INTERNAL_SERVER_ERROR);
if (debug) writeLog(axe);
displayException(response, axe, debug);
}
finally
{
xslprocessor.reset();
} // end of try ... catch ... finally
} // end of blank block
}
catch (org.xml.sax.SAXException saxExc)
{