I found an error when running this under Saxon-EE:

https://saxonica.plan.io/issues/1927

but I think that's unrelated to the problem you are seeing. I think your problem is in some way dependent on the environment in which you are running. (It's a strange environment, insofar as the stack trace is upside down!)  The exception is occurring at the point where Saxon attempts to obtain an XML parser, which is certainly an area that could depend on the processing environment; though I'm puzzled that there's no cast on line 2156, so I think I need to know exactly what maintenance release you are running.

Running with the system property jaxp.debug=1 might yield some extra diagnostics.

Michael Kay
Saxonica


On 24 Oct 2013, at 16:01, Hegyvari Krisztian <Hegyvari.Krisztian@ardents.hu> wrote:

Hi,
 
I am trying to use a combination of saxon 9.5 HE and apache fop to create a pdf.  I get an exception:
 
XMLTransform.apachefop(XMLTRANSFORM:26)
net.sf.saxon.Controller.transform(Controller.java:1903)
net.sf.saxon.Controller.transformDocument(Controller.java:2080)
net.sf.saxon.trans.Mode.applyTemplates(Mode.java)
net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java)
net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:241)
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:258)
net.sf.saxon.expr.parser.ExpressionTool.lazyEvaluate(ExpressionTool.java:438)
net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:299)
net.sf.saxon.expr.VariableReference.evaluateVariable(VariableReference.java:505)
net.sf.saxon.expr.instruct.GlobalVariable.evaluateVariable(GlobalVariable.java:587)
net.sf.saxon.expr.instruct.GlobalVariable.actuallyEvaluate(GlobalVariable.java:615)
net.sf.saxon.expr.instruct.GlobalVariable.getSelectValue(GlobalVariable.java:563)
net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:338)
net.sf.saxon.expr.instruct.Instruction.iterate(Instruction.java:361)
net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:56)
net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:323)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:465)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:465)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:241)
net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:265)
net.sf.saxon.expr.instruct.Instruction.iterate(Instruction.java:361)
net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:56)
net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:323)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:613)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java)
net.sf.saxon.expr.instruct.Instruction.process(Instruction.java)
net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java)
net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:613)
net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:461)
net.sf.saxon.expr.MappingIterator.next(MappingIterator.java:63)
net.sf.saxon.expr.ForExpression$MappingAction.map(ForExpression.java:714)
net.sf.saxon.functions.KeyFn.iterate(KeyFn.java:246)
net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:269)
net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java)
net.sf.saxon.functions.DocumentFn$DocumentMappingFunction.mapItem(DocumentFn.java:269)
net.sf.saxon.functions.DocumentFn.makeDoc(DocumentFn.java:404)
net.sf.saxon.event.Sender.send(Sender.java:143)
net.sf.saxon.event.Sender.sendSAXSource(Sender.java:294)
net.sf.saxon.Configuration.getSourceParser(Configuration.java:2156)
java.lang.ClassCastException
 
Any idea why? The stylesheet was created with Altova.
 
The code:
 
    public static int apachefop (CLOB p_xml, CLOB p_xsl, BLOB p_res) throws java.sql.SQLException {
        try {
            FopFactory fopFactory = FopFactory.newInstance();
            java.io.OutputStream out=p_res.setBinaryStream(1);
 
            try {
                Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
                TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl();
                StreamSource xsl_source=new StreamSource(p_xsl.getCharacterStream());
 
                Transformer transformer = factory.newTransformer(xsl_source);
                Source src = new StreamSource(p_xml.getCharacterStream());
                Result res = new SAXResult(fop.getDefaultHandler());
                transformer.transform(src, res);
 
            } finally {
                out.close();
            }
            return (0);
        }
        catch (Exception e)
        {
            naplo_iras (e.toString(),0,0);
            StackTraceElement[] stack=e.getStackTrace();
            for (int i=0;i<stack.length;i++) {
                naplo_iras (stack[i].toString(),stack[i].getLineNumber(),0);
            }
            return (-1);
        }
 
The code works with stylesheets that are much simpler than the one I have attached.
 
Thanks for any help.
 
Krisztian
 
 
<bm_szemely_valaszfo.xslt><bm_szemely_valasz.xml>------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help