Hello, I'm having problems with a page-sequence-master page layout in my XSL. I want the first page of my PDF to be formatted differently to any subsequent pages, hence I have defined the following layout master:
<fo:layout-master-set> <fo:page-sequence-master master-name="seq-master"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference page-position="first" master-name="first"/> <fo:conditional-page-master-reference page-position="rest" master-name="rest"/> </fo:repeatable-page-master-alternatives> </fo:page-sequence-master> <fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="0cm" margin-bottom="0.5cm" margin-left="1.5cm" margin-right="1.5cm"> <fo:region-before extent="0.8cm"/> <fo:region-body margin-top="0.8cm"/> <fo:region-after extent="0.5cm"/> </fo:simple-page-master> <fo:simple-page-master master-name="rest" page-height="29.7cm" page-width="21cm" margin-top="0cm" margin-bottom="0.5cm" margin-left="1.5cm" margin-right="1.5cm"> <fo:region-body margin-top="0.8cm"/> <fo:region-before extent="2cm" region-name="rest-before-region"/> <fo:region-after extent="0.5cm"/> </fo:simple-page-master> </fo:layout-master-set> The rest of my XSL is then: <fo:page-sequence master-reference="seq-master" initial-page-number="1"> <fo:static-content flow-name="rest-before-region"> <fo:block text-align="start" font-weight="normal">HEADING TEXT FOR PAGES AFTER PAGE 1</fo:block> </fo:static-content> <fo:flow flow-name="xsl-region-body"> ........................... ........................... </fo:flow> </fo:page-sequence> The idea is that "HEADING TEXT FOR PAGES AFTER PAGE 1" will appear at the top of pages 2 onwards, but not on page 1. However, when I run try to create a PDF using FOP from within my Java application, FOP throws exceptions (stack trace attached as a file - too long to paste directly into email). The first error is thrown by Xalan, and then FOP errors follow. When I use the simple-page-master "first" by itself (as defined above), without a page-sequence-master, I get no such problems. Can anyone help? I realise the problem is probably within my XSL but I thought it would be useful to post to this list as FOP experts may be able to recognize the cause of the problem from the stack trace of FOP errors. Thanks in advance for any help, Haitham. <<StackTrace.txt>>
[INFO]: building formatting object tree [INFO]: Parsing of document complete, stopping renderer javax.xml.transform.TransformerException at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- java.lang.NullPointerException at org.apache.fop.fo.pagination.PageSequence.isFlowForMasterNameDone(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextPageMasterName(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextSimplePageMaster(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextPageMaster(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.makePage(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.format(Compiled Code) at org.apache.fop.apps.StreamRenderer.render(Compiled Code) at org.apache.fop.fo.FOTreeBuilder.endElement(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) org.apache.fop.apps.FOPException at org.apache.fop.apps.Driver.render(Compiled Code) at XMLtoPDF.XMLtoPDF.main(Compiled Code) --------- javax.xml.transform.TransformerException at org.apache.xalan.transformer.TrAXFilter.parse(Compiled Code) at org.apache.fop.apps.Driver.render(Compiled Code) at XMLtoPDF.XMLtoPDF.main(Compiled Code) --------- javax.xml.transform.TransformerException at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- java.lang.NullPointerException at org.apache.fop.fo.pagination.PageSequence.isFlowForMasterNameDone(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextPageMasterName(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextSimplePageMaster(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.getNextPageMaster(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.makePage(Compiled Code) at org.apache.fop.fo.pagination.PageSequence.format(Compiled Code) at org.apache.fop.apps.StreamRenderer.render(Compiled Code) at org.apache.fop.fo.FOTreeBuilder.endElement(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) [INFO]: building formatting object tree org.apache.fop.apps.FOPException: root must be root element at org.apache.fop.apps.Driver.render(Compiled Code) at XMLtoPDF.XMLtoPDF.main(Compiled Code) --------- javax.xml.transform.TransformerException: root must be root element at org.apache.xalan.transformer.TrAXFilter.parse(Compiled Code) at org.apache.fop.apps.Driver.render(Compiled Code) at XMLtoPDF.XMLtoPDF.main(Compiled Code) --------- javax.xml.transform.TransformerException: root must be root element at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- javax.xml.transform.TransformerException: root must be root element at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- org.apache.fop.apps.FOPException: root must be root element at org.apache.fop.fo.FOTreeBuilder.startElement(Compiled Code) at org.apache.xalan.transformer.QueuedStartElement.flush(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.flushPending(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- org.apache.fop.apps.FOPException: root must be root element at org.apache.fop.fo.pagination.Root$Maker.make(Compiled Code) at org.apache.fop.fo.FOTreeBuilder.startElement(Compiled Code) at org.apache.xalan.transformer.QueuedStartElement.flush(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.flushPending(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- org.apache.fop.apps.FOPException: root must be root element at org.apache.fop.fo.FOTreeBuilder.startElement(Compiled Code) at org.apache.xalan.transformer.QueuedStartElement.flush(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.flushPending(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code) --------- org.apache.fop.apps.FOPException: root must be root element at org.apache.fop.fo.pagination.Root$Maker.make(Compiled Code) at org.apache.fop.fo.FOTreeBuilder.startElement(Compiled Code) at org.apache.xalan.transformer.QueuedStartElement.flush(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.flushPending(Compiled Code) at org.apache.xalan.transformer.ResultTreeHandler.endElement(Compiled Code) at org.apache.xalan.templates.ElemLiteralResult.execute(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.transformNode(Compiled Code) at org.apache.xalan.transformer.TransformerImpl.run(Compiled Code) at java.lang.Thread.run(Compiled Code)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]