i want to be able to apply one or more sytle sheets on an xml data. i have this code and i am wondering how i can modify it so i can apply as many style sheets on a single xml data and the result be printed on the text area of a GUI ( as i presume settext() accepts only strings) and saved on a file at the same time. these are my codes.. thank you
/**
* Constructor for objects of class Simple
*/
public Simple(String xmlFile, String xslFile,String outputFile)
{
this.xmlFile = xmlFile;
this.xslFile = xslFile;
this.outputFile= outputFile;
}
public String SimpleTransform() throws
TransformerException,TransformerConfigurationException,FileNotFoundException,
IOException
{String mystring = "";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
transformer.transform(new StreamSource(xmlFile), new StreamResult(new
FileOutputStream(outputFile)));
return mystring = "***The result is in birds.out *****";
}
}
You need transformation filter chain: Read Concatenating Transformations with a Filter Chain