Hi
i'm getting exception on Transformer transformer = tFactory.newTransformer(StreamXSL);
but the error below is not explicit i cannot understand why "Could not compile stylesheet" ?
Tks
static String getHtml(String xml)
{
Element elementObj = getElementObject(xml);
String xslName = getValueOfElement(elementObj, xml, "XSL_TO_RUN");
StreamSource StreamXML = new StreamSource(new StringReader(xml));
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
if(xslName!=null){
String xslfile = xslName;
File xfile = new File(xslfile);
if (xfile.exists()){}
else
{
LogI.log(4,"getHtml:: ERROR: xsl file don´t Exist! " + xslName );
return null;
}
StreamSource StreamXSL = new StreamSource(xfile);
Transformer transformer = tFactory.newTransformer(StreamXSL);
}else{
LogI.log(0,"getHtml::ERROR->Error on create stream XSL");
return null;
}
} catch(TransformerConfigurationException ex){
LogI.log(0,"getHtml::Erro crossing the XML with the XSL:" + ex);
LogI.log(0,"getHtml::Erro crossing the XML with the XSL(1):" + ex.getMessageAndLocation());
LogI.log(0,"getHtml::Erro crossing the XML with the XSL(2):" + ex.getMessage());
for(int i=0;i<ex.getStackTrace().length;i++){
LogI.log(0, "ARQ::Pedido:: ERRO(2) ->" + ex.getStackTrace()[i]);
}
return null;
} catch(Exception e){
LogI.log(0,"getHtml::Erro crossing the XML with the XSL:" + e);
//out.clear();
//out.println(errorPage);
return null;
}
}
Here is the output:
ERRO: getHtml::Erro crossing the XML with the XSL:javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
ERRO: getHtml::Erro crossing the XML with the XSL(1):Could not compile stylesheet
ERRO: getHtml::Erro crossing the XML with the XSL(2):Could not compile stylesheet
ERRO: ARQ::Pedido:: ERRO(2) ->com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
ERRO: ARQ::Pedido:: ERRO(2) ->com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
ERRO: ARQ::Pedido:: ERRO(2) ->BizBanc.Arq.getHtml(Arq.java:189)
ERRO: ARQ::Pedido:: ERRO(2) ->BizBanc.Arq.getResponse(Arq.java:792)