[xsl] Could not compile stylesheet message upon running transformation in java

Subject: [xsl] Could not compile stylesheet message upon running transformation in java
From: UlyLee <ulyleeka@xxxxxxxxx>
Date: Wed, 28 Dec 2005 02:56:10 -0800 (PST)
I'm new in java and was trying out running
transformation using the javax.xml.transform. I
designed my code using the Sun Java Studio Enterprise
and i have no problems running my code and
transformation in the IDE but when i create a jar file
and then run my application i get a could not compile
stlysheet message.

I have this stacktrace generated from the error:
javax.xml.transform.TransformerConfigurationException:
Could not compile stylesheet
	at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown
Source)
	at
ya2.CombineUtility.processTransform(CombineUtility.java:357)
	at
ya2.CombineUtility.jButton3ActionPerformed(CombineUtility.java:316)
	at
ya2.CombineUtility.access$400(CombineUtility.java:19)
	at
ya2.CombineUtility$5.actionPerformed(CombineUtility.java:179)
	at
javax.swing.AbstractButton.fireActionPerformed(Unknown
Source)
	at
javax.swing.AbstractButton$Handler.actionPerformed(Unknown
Source)
	at
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown
Source)
	at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Source)
	at java.awt.Component.processMouseEvent(Unknown
Source)
	at javax.swing.JComponent.processMouseEvent(Unknown
Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown
Source)
	at java.awt.Container.dispatchEventImpl(Unknown
Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
Source)
	at
java.awt.LightweightDispatcher.processMouseEvent(Unknown
Source)
	at
java.awt.LightweightDispatcher.dispatchEvent(Unknown
Source)
	at java.awt.Container.dispatchEventImpl(Unknown
Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown
Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown
Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

I dont quite figure out why its telling me that the
xsl file is an unknown source. I have the xsl files
needed for my application at the same folder as that
of the jar file.

here is my java code:

processTransform(files[i], new
File("YA2Combine_1.0.xsl"));

public void processTransform(File sourceID, File
xslID)
            throws TransformerException,
TransformerConfigurationException {
        String str="", pFile="", paramDir="",
outFile="";
             
        TransformerFactory tfactory =
TransformerFactory.newInstance();
        Templates templates =
tfactory.newTemplates(new StreamSource(xslID));
        Transformer transformer =
templates.newTransformer();
        paramDir = sourceID.getParent().substring(0,
sourceID.getParent().length()-13);
        paramDir = paramDir.replace("\\","/") +
"Processed file/";
        str = sourceID.getName().substring(0,
sourceID.getName().length()-5);        
        pFile = "file:///" + paramDir + str + "P.xml";
        transformer.setParameter("PFile",
pFile.replace(" ", "%20"));
        outFile =
outputFolder.toString().replace("\\", "/") + "/" + str
+ "M.xml";
        File outputFile = new File(outFile);
        try{
            StreamResult out = new StreamResult(new
FileOutputStream(outputFile));
            transformer.transform(new
StreamSource(sourceID), out);
            out.getOutputStream().close();
        }catch(TransformerException e){
            System.out.println(e.toString());
            JOptionPane.showMessageDialog(this,
e.toString(), "Error", JOptionPane.ERROR_MESSAGE);
        }catch(IOException ex) {
            System.out.println(ex.toString());
            JOptionPane.showMessageDialog(this,
ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
        }
        jLabel3.setText("Generating report");
        processReport(outputFile, new
File("YA2CombineReport_1.0.xsl"), pFile);
    }

Hope someone can help me with this!
Thanks,
UlyLee



		
__________________________________________ 
Yahoo! DSL  Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 

Current Thread