class XslBasedResponseFormatter implements ResponseFormatter {

    @Override
    public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp,
                                 final byte[] templateResource, final ParameterList params) throws Exception {
        String xslResourcePath = checkAndGetXslResourcePath(params);
        byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath);
        byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8);
        return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource);
    }

}