This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Loading XSL template from URL for transformation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Loading XSL template from URL for transformation" Watch "Loading XSL template from URL for transformation" New topic

Loading XSL template from URL for transformation

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
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

Joined: May 13, 2001
Posts: 296
I seem to be having a similar problem.

Did you ever find a solution?

Which JRE were you using?
jQuery in Action, 2nd edition
subject: Loading XSL template from URL for transformation
Similar Threads
Transformer Exception -- Please help.
https problem
Read data to the xml file from the database?
converting XML with XSLT
XSLT Transformation in jav