xslt - For each in FOP xml -


i'm generating pdf through apache fop, , since things going pretty well.

now need loop through list , display every element in , achieve i'm using command <xsl:for-each select="myobject/mylist">, when fop begin parse xml error:

2015-09-30 12:04:39,772 [http-nio-8080-exec-4] warn  org.apache.fop.apps.fouseragent - unknown formatting object "{http://www.w3.org/1999/xsl/transform}for-each" encountered (a child of fo:root}. (see position 9:45) java.lang.classcastexception: org.apache.fop.fo.unknownxmlobj cannot cast org.apache.fop.fo.pagination.root     @ org.apache.fop.fo.pagination.abstractpagesequence.getroot(abstractpagesequence.java:145)     @ org.apache.fop.fo.pagination.pagesequence.startofnode(pagesequence.java:111)     @ org.apache.fop.fo.fotreebuilder$mainfohandler.startelement(fotreebuilder.java:337)     @ org.apache.fop.fo.fotreebuilder.startelement(fotreebuilder.java:179)     @ org.apache.xalan.transformer.transformeridentityimpl.startelement(transformeridentityimpl.java:1072) [...] 

this structure of xml:

<?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/xsl/format" xmlns:xsl="http://www.w3.org/1999/xsl/transform">     <fo:layout-master-set>         <fo:simple-page-master master-name="a4-portrait"             page-height="29.7cm" page-width="21.0cm" margin="1.5cm">             <fo:region-body />         </fo:simple-page-master>     </fo:layout-master-set>     <xsl:for-each select="myobject/mylist">         <fo:page-sequence master-reference="a4-portrait">             <fo:flow flow-name="xsl-region-body" font-size="9">                 ## stuff written here ##             </fo:flow>         </fo:page-sequence>     </xsl:for-each> </fo:root> 

i understood problem fact fop wants fo: elements. , if correct, how can loop on list?

you need xslt (or same job) convert xml fo vocabulary fop understands.

your xsl:for-each understood xslt processor. see 'hello world fop' in fop quick start guide @ http://xmlgraphics.apache.org/fop/quickstartguide.html minimal example.

fop can run xslt transformation part of processing, can use standalone xslt processor such saxon produce fo file can feed fop.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -