Transformer transformer = null;
transformer = (Transformer) stylesheet.newTransformer();
TransformerImpl cauchoTransformer = null;
if (transformer instanceof TransformerImpl)
cauchoTransformer = (TransformerImpl) transformer;
String mediaType = (String) transformer.getOutputProperty(OutputKeys.MEDIA_TYPE);
String encoding = (String) transformer.getOutputProperty(OutputKeys.ENCODING);
String method = (String) transformer.getOutputProperty(OutputKeys.METHOD);
if (encoding != null) {
}
else if (method == null) {
}
else if (method.equals("xml"))
encoding = "UTF-8";
if (encoding != null) {
if (mediaType == null)
mediaType = "text/html";
res.setContentType(mediaType + "; charset=" + encoding);
}
else if (mediaType != null)
res.setContentType(mediaType);
else
res.setContentType("text/html");
if (encoding == null)
encoding = "ISO-8859-1";
transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
ArrayList<?> params = null;;
if (cauchoTransformer != null) {
params = (ArrayList<?>) cauchoTransformer.getProperty(CauchoStylesheet.GLOBAL_PARAM);
}
for (int i = 0; params != null && i < params.size(); i++) {
String param = (String) params.get(i);