Re: [xsl] [FO] image on even, table on odd, repeating image if the table is more than one page

Subject: Re: [xsl] [FO] image on even, table on odd, repeating image if the table is more than one page
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Jul 2012 11:40:44 +0200
Hi Ken,

Thank you very much for this.
It is very much in line with what I tried....
it gives me the following error using FOP

The error was:
ERROR - Exception
java.lang.UnsupportedOperationException: Flow "frame-body" does not map to the region-body in page-master "frame-even". FOP presently does not support this.


FOP seems unable to deal with the fact that the flow on the odd and the flow on the even pages are different.

You have given me enough arguments for changing FO processor I believe

Thanks for your time and efforts Ken

Cheers
Geert


At 04:37 12/07/2012, G. Ken Holman wrote:
At 2012-07-11 20:58 +0200, Geert Bormans wrote:
well, I have a bunch of sections in a book,
each section has one partlist (= one table)
and each partlist (table) has exactly one image with it
The image the table and some titles is all there is to a section

A section needs an even number of pages,
starting with the image on the even page and the table on the odd page
if the table overflows to the next page, it needs to flow over to the next odd page,
and I need the image to repeat on the even page in between


I can figure out what the image is when the section starts,
so indeed I believe that Kens approach will likely work

I started implementing this but got stuck on step one,
it seems FOP doesn't like the way I force the even page to be empty
so I would indeed appreciate some code

Oh! What you've described is even easier than what I thought!


The example below works with Antenna House, RenderX and Ibex. It has a filler page for page 1, then starting on page 2 is the combination of a fixed image on every even page and running flow on every odd page. I haven't tested it with FOP.

You would only need to resort to markers if you needed to do this more than once in a given page-sequence. Your description implies that each section is in its own page-sequence, which is what I've coded below. No markers are needed at all in this case.

I hope this helps.

. . . . . . . . . . . Ken

~/y/samp $ cat partslist.fo
<?xml version="1.0" encoding="utf-8"?><!--partslist.fo-->
<!DOCTYPE root [ <!ENTITY % geometry SYSTEM "pages.ent"> %geometry; ]>
<root font-family="Times" font-size="20pt"
         xmlns="http://www.w3.org/1999/XSL/Format";>

<layout-master-set>
      <simple-page-master master-name="frame-odd"
        page-height="297mm" page-width="210mm"
        margin-top="15mm" margin-bottom="15mm"
        margin-left="15mm" margin-right="15mm">
         <region-body region-name="frame-body"
           margin-top="13mm" margin-bottom="13mm"/>
      </simple-page-master>
      <simple-page-master master-name="frame-even"
        page-height="297mm" page-width="210mm"
        margin-top="15mm" margin-bottom="15mm"
        margin-left="15mm" margin-right="15mm">
         <region-body region-name="frame-image"
           margin-top="13mm" margin-bottom="13mm"/>
      </simple-page-master>
  <page-sequence-master master-name="frame-pages">
    <repeatable-page-master-alternatives>
      <conditional-page-master-reference odd-or-even="even"
        master-reference="frame-even"/>
      <conditional-page-master-reference odd-or-even="odd"
        master-reference="frame-odd"/>
    </repeatable-page-master-alternatives>
  </page-sequence-master>
</layout-master-set>

<page-sequence master-reference="frame-pages">
  <flow flow-name="frame-body">
    <block>Filler first page</block>
  </flow>
</page-sequence>

<page-sequence master-reference="frame-pages" force-page-count="even">

<static-content flow-name="frame-image">
  <block>
    <instream-foreign-object>
      <svg
   xmlns:dc="http://purl.org/dc/elements/1.1/";
   xmlns:cc="http://creativecommons.org/ns#";
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
   xmlns:svg="http://www.w3.org/2000/svg";
   xmlns="http://www.w3.org/2000/svg";
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
   width="744.09448819"
   height="1052.3622047"
   id="svg2"
   version="1.1"
   inkscape:version="0.47 r22583"
   sodipodi:docname="New document 1">
  <defs
     id="defs4">
    <inkscape:perspective
       sodipodi:type="inkscape:persp3d"
       inkscape:vp_x="0 : 526.18109 : 1"
       inkscape:vp_y="0 : 1000 : 0"
       inkscape:vp_z="744.09448 : 526.18109 : 1"
       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
       id="perspective10" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.35"
     inkscape:cx="375"
     inkscape:cy="520"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:window-width="1187"
     inkscape:window-height="825"
     inkscape:window-x="4"
     inkscape:window-y="22"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <path

style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 345.71428,200.93361 C 165.71429,615.21932 165.71429,618.07647 165.71429,618.07647 l 405.71428,-265.71429 -457.14286,2.85715 380,260 -148.57143,-414.28572 z"
id="path2816"
sodipodi:nodetypes="cccccc" />
<text
xml:space="preserve"


style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="157.14287"
y="658.07648"
id="text2818"><tspan
sodipodi:role="line"
id="tspan2820"
x="157.14287"
y="658.07648">The item of parts</tspan></text>
</g>
</svg>
</instream-foreign-object>
</block>
</static-content>


<flow flow-name="frame-body" font-size="30pt">

<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>
<block>A table of parts goes here.</block>

</flow>

</page-sequence>

</root>
~/y/samp $ cat pages.ent
<!--pages-a4.ent - for use as "pages.ent"-->
<!--Simple page geometry for testing basic constructs-->
<!--A4 page size-->

<!--copy this file over top of the "pages.ent" file to
    have the examples produce the desired page size.
-->

<!ENTITY page-width    "210mm">
<!ENTITY page-height   "297mm">
<!ENTITY margin-top    "15mm">
<!ENTITY margin-bottom "15mm">
<!ENTITY margin-left   "15mm">
<!ENTITY margin-right  "15mm">
<!ENTITY before-extent "13mm">
<!ENTITY after-extent  "13mm">

<!--end of file-->
~/y/samp $


-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread