ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
[xsl] Could not compile stylesheet message upon running transformation in java
by UlyLee other posts by this author
Dec 28 2005 2:56AM messages near this date
RE: [xsl] Copy all elemnts but one, not working | [xsl] removing namespace
& XSLT 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 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@[...].com> 
--~--

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved