*/
public static void transform(StreamSource inputStream, StreamResult outputStream, HashMap parameters) throws
TransformerException, TransformerConfigurationException,
FileNotFoundException, IOException, Exception {
TransformerFactory tFactory = TransformerFactory.newInstance();
ByteArrayOutputStream bAOS = new ByteArrayOutputStream();
InputStream in = inputStream.getInputStream();
int c;
while ((c = in.read()) != -1) {
bAOS.write((char) c);
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bAOS.toByteArray());
Source stylesheet = tFactory.getAssociatedStylesheet(new StreamSource(byteArrayInputStream)
, null, null, null);
if ( stylesheet == null ) throw (new Exception("SOSXMLTransformer: no stylesheet found in input file." ));
Transformer transformer = tFactory.newTransformer(stylesheet);
addParameters(transformer, parameters);
byteArrayInputStream = new ByteArrayInputStream(bAOS.toByteArray());
transformer.transform(new StreamSource(byteArrayInputStream),
outputStream);
}