Thursday, April 23, 2009

Java SXL Transformation

TransformerFactory tFactory = TransformerFactory.newInstance();
Source xslSource = new StreamSource(new File(CORE_DIR+"/conf/xslt","media.xsl"));
transformer = tFactory.newTransformer(xslSource);

StringReader sr = new StringReader(result);
StringWriter sw = new StringWriter();

Source xmlInput = new StreamSource();
StreamResult xmlOutput = new StreamResult(sw);

transformer.transform(xmlInput, xmlOutput);
//System.out.println(sr);
System.out.println(sw);

No comments:

Post a Comment