use of org.mycore.common.content.transformer.MCRXSL2XMLTransformer in project mycore by MyCoRe-Org.
the class MCRMailer method transform.
/**
* Transforms the given input element using xsl stylesheet.
*
* @param input the input document to transform.
* @param stylesheet the name of the xsl stylesheet to use, without the ".xsl" ending.
* @param parameters the optionally empty table of xsl parameters
* @return the output document generated by the transformation process
*/
private static Document transform(Document input, String stylesheet, Map<String, String> parameters) throws Exception {
MCRJDOMContent source = new MCRJDOMContent(input);
MCRXSL2XMLTransformer transformer = MCRXSL2XMLTransformer.getInstance("xsl/" + stylesheet + ".xsl");
MCRParameterCollector parameterCollector = MCRParameterCollector.getInstanceFromUserSession();
parameterCollector.setParameters(parameters);
MCRContent result = transformer.transform(source, parameterCollector);
return result.asXML();
}
Aggregations