• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Transformation error

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using XSLT to transform a XML into another XML and running into the following error.

javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
at com.filter.XMLFilter.transformXMLFile(XMLFilter.java:183)
at com.filter.XMLFilter.Run(XMLFilter.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)

and goes on..........

I have been trying to resolve this from morning but of no use. Could someone help me in resolving this.

Here is my transformation code

TransformerFactory tFactory =TransformerFactory.newInstance();
StreamSource stylesource = new StreamSource(stylesource);
transformer = tFactory.newTransformer(stylesource); // This line is giveing the exception
DOMSource source = new DOMSource(document);
File f = new File(origFileName + "-transform.xml");
StreamResult result = new StreamResult(f);
transformer.transform(source, result);
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does your code REALLY say

"StreamSource stylesource = new StreamSource(stylesource);"

???

I suppose that might compile, and if it does I suppose it's equivalent to

"StreamSource stylesource = new StreamSource(null);"

That would definitely cause the transformer to fail.
 
Latha setty
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,

I pasted it wrong.

The line actually is

StreamSource stylesource = new StreamSource(stylesheet);

Any idea why it is failing?

Regards
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic