class PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, InitializingBean {

	@Override
	public void afterPropertiesSet() throws Exception {
		if (requestXslt == null && responseXslt == null) {
			throw new IllegalArgumentException("Setting either 'requestXslt' or 'responseXslt' is required");
		}
		TransformerFactory transformerFactory = getTransformerFactory();
		XMLReader xmlReader = XMLReaderFactory.createXMLReader();
		xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
		if (requestXslt != null) {
			Assert.isTrue(requestXslt.exists(), "requestXslt \"" + requestXslt + "\" does not exit");
			if (logger.isInfoEnabled()) {
				logger.info("Transforming request using " + requestXslt);
			}
			Source requestSource = new ResourceSource(xmlReader, requestXslt);
			requestTemplates = transformerFactory.newTemplates(requestSource);
		}
		if (responseXslt != null) {
			Assert.isTrue(responseXslt.exists(), "responseXslt \"" + responseXslt + "\" does not exit");
			if (logger.isInfoEnabled()) {
				logger.info("Transforming response using " + responseXslt);
			}
			Source responseSource = new ResourceSource(xmlReader, responseXslt);
			responseTemplates = transformerFactory.newTemplates(responseSource);
		}
	}

}