xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pham Duy Hung <duyhu...@gmail.com>
Subject 'Could not compile stylesheet' with XSLTInputHandler(InputSource, InputSource)
Date Wed, 08 Apr 2009 02:39:46 GMT

Hi, please help me to resolve this debug, im using FOP to render Report using
XML and XSL. But this's a problem when using XSLTInputHandler. I'd tried 2
way

1> With Syntax: XSLTInputHandler(File, File) -> its run ok

public void generateReport(
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {

       XSLTInputHandler input = new XSLTInputHandler(new
File("C:\\glossary.xsl"), new File("C:\\glossary.xsl"));
       FOPRender render = new FOPRender(response);
       render.renderXML(input);

}

2> With Synxtax:  XSLTInputHandler(InputSource, InputSource) -> Error:
'Could not compile stylesheet'

Details:

[Fatal Error] :1:1: Premature end of file.
ERROR:  'Premature end of file.'
FATAL ERROR:  'Could not compile stylesheet'
org.apache.fop.apps.FOPException: Could not compile stylesheet
    at
org.apache.fop.apps.TraxInputHandler.initTransformer(TraxInputHandler.java:108)
    at
org.apache.fop.apps.TraxInputHandler.<init>(TraxInputHandler.java:100)
    at org.apache.fop.apps.XSLTInputHandler.<init>(XSLTInputHandler.java:81)
    at com.n2n.report.bean.test.generateReport(test.java:60)
    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:597)
    at com.n2n.report.servlet.ReportSerlvet.doPost(ReportSerlvet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:619)


My code is very simple for test:

public void generateReport(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
           
            InputStream inXSL = new FileInputStream("C:/glossary.xsl");
            DataInputStream dis;
            dis = new DataInputStream(inXSL);
            while(dis.available()!=0){
                System.out.println(dis.readLine());
            }
           
            InputStream inXML = new FileInputStream("C:/glossary.xml");
            dis = new DataInputStream(inXML);
            while(dis.available()!=0){
                System.out.println(dis.readLine());
            }
           
            FOPRender render = new FOPRender(response);
            XSLTInputHandler input = null;
            try {
                input = new XSLTInputHandler(new InputSource(inXML), new
InputSource(inXSL));
            } catch (FOPException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            render.renderXML(input);
    }

When im using :

DataInputStream dis;
dis = new DataInputStream(inXSL);
while(dis.available()!=0){
         System.out.println(dis.readLine());
}

The Content of 2 files is displayed successfully
Thanks very much
-- 
View this message in context: http://www.nabble.com/%27Could-not-compile-stylesheet%27-with-XSLTInputHandler%28InputSource%2C-InputSource%29-tp22942044p22942044.html
Sent from the Xml Graphics - General mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Mime
View raw message