Hello!
My code to transformation:
private boolean transformXML(String strPFileXML, String strPFileXSL,
String strPArquivoSaida, String strPPathLMPL) throws Exception {
boolean retorno = true;
StreamSource xmlSource = null;
StreamSource xslSource = null;
StreamResult outSource = null;
TransformerFactory tFactory = null;
Transformer transformer = null;
try {
System.setProperty("javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
tFactory = TransformerFactory.newInstance();
System.out.println("Processador: " + tFactory.getClass().getName());
xmlSource = new StreamSource(strPFileXML);
xslSource = new StreamSource(strPFileXSL);
outSource = new StreamResult(new FileOutputStream(strPFileSaida));
// Templates templates = tFactory.newTemplates(xslSource);
// transformer = templates.newTransformer();
transformer = tFactory.newTransformer(xslSource);
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// parametro do local do XSL
transformer.setParameter("directory", strPPathLMPL);
// transforma
transformer.transform(xmlSource, outSource);
} catch (Exception e) {
retorno = false;
System.out.println("Error: " + e.getMessage());
} finally {
tFactory = null;
transformer = null;
xmlSource = null;
xslSource = null;
}
return retorno;
}
Problems: Exception = error: -999 ? Why?
Thanks a lot
Eder
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--