Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading XSL template from URL for transformation  RSS feed

Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • 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,
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);

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(
at oracle.xml.jaxp.JXSAXTransformerFactory.newTemplates(
at oracle.xml.jaxp.JXSAXTransformerFactory.newTransformer(

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.
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I seem to be having a similar problem.

Did you ever find a solution?

Which JRE were you using?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!