• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Loading XSL template from URL for transformation

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a simple transformation utility from one XML to another using a xsl template.

public void transform(String inXML,String inXSL,String outTXT)
throws TransformerConfigurationException,
TransformerException,IOException{
debug("Inside transform : " + inXSL);
TransformerFactory factory = TransformerFactory.newInstance();
debug("Created factory");
URL url = new URL(inXSL);
StreamSource xslStream = new StreamSource(url.openStream());

debug(" Loaded stream");
Transformer transformer = factory.newTransformer(xslStream);====>FAILS ON THIS LINE
("Created transformer");
transformer.setErrorListener(new TransformErrorListener());

StreamSource in = new StreamSource(inXML);
StreamResult out = new StreamResult(outTXT);
transformer.transform(in,out);
}

We attempt to send in a URL as source of the XSL.
However,we get a fatal error with no meaningful exception message
javax.xml.transform.TransformerConfigurationException: XML-22000: (Fatal Error) Error while parsing XSL file ({0}).
at oracle.xml.jaxp.JXSAXTransformerFactory.reportConfigException(JXSAXTransformerFactory.java:690)
at oracle.xml.jaxp.JXSAXTransformerFactory.newTemplates(JXSAXTransformerFactory.java:342)
at oracle.xml.jaxp.JXSAXTransformerFactory.newTransformer(JXSAXTransformerFactory.java:250)
at

Does this error look familiar to anyone?
When we load the same source from a file - the transformation is successful.
Any help will be appreciated.
 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I seem to be having a similar problem.

Did you ever find a solution?

Which JRE were you using?
 
Nothing? Or something? Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic