Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] XSL-FO page layout question

From: Wendell Piez <wapiez@---------------->
To:
Date: 4/2/2007 7:52:00 PM
Cindy,



Sorry if you've been waiting -- been busy. (It happens. And for 
whatever reason, people aren't as ready to jump in on XSL-FO questions.)



Anyhow, I imagine what you want can probably be done by using 
attributes on your page-sequence elements. Check out, in particular, 
the force-page-count="even" or ="end-on-even" settings. That way each 
page sequence will start on an odd page. Then you shouldn't need the 
break-before behavior, but your pages will still be assigned their 
layouts more in line with your expectations.



Good luck,
Wendell

At 09:47 AM 3/30/2007, you wrote:
Thanks - this definitely gave me a good start. I did not realize I 
could put the page-sequences inside the element definition so that 
makes lots more sense to me now. This is helping but it looks like 
if one of my chapters just has a single page then the first page of 
the next chapter gets the odd-before static content rather than the 
first-page one. I know that because I stuck an "XXX" after the page 
number for the first-page to show me which model it gets. I tried 
sticking in a blank-page definition but that doesn't seem to help. Any ideas?



Here is what I have now:



                        <fo:layout-master-set>

                                <fo:simple-page-master 
master-name="first-page" xsl:use-attribute-sets="pageDimensions">

                                        <fo:region-body margin-top="0pt" />

                                        <fo:region-before 
region-name="first-before" extent="32pt" />

                                        <fo:region-start extent="93pt" />

                                </fo:simple-page-master>

                                <fo:simple-page-master 
master-name="odd-page" xsl:use-attribute-sets="pageDimensions">

                                        <fo:region-body 
margin-top="71.5pt" />

                                        <fo:region-before 
region-name="odd-before" extent="45pt" />

                                        <fo:region-start extent="93pt" />

                                </fo:simple-page-master>

                                <fo:simple-page-master 
master-name="even-page" xsl:use-attribute-sets="pageDimensions">

                                        <fo:region-body 
margin-top="71.5pt" />

                                        <fo:region-before 
region-name="even-before" extent="45pt" />

                                        <fo:region-start extent="93pt" />

                                </fo:simple-page-master>

                                <fo:simple-page-master 
master-name="blank-page" xsl:use-attribute-sets="pageDimensions">

                                        <fo:region-body 
margin-top="71.5pt" />

                                        <fo:region-before 
region-name="body-blank" extent="45pt" />

                                        <fo:region-start extent="93pt" />

                                </fo:simple-page-master>

                                <fo:page-sequence-master 
master-name="my-sequence">

                                    <fo:repeatable-page-master-alternatives>



<fo:conditional-page-master-reference page-position="first"



master-reference="first-page" odd-or-even="odd"/>



<fo:conditional-page-master-reference odd-or-even="odd" 
blank-or-not-blank="not-blank"

                                              master-reference="odd-page"/>



<fo:conditional-page-master-reference odd-or-even="even" 
blank-or-not-blank="not-blank"

                                              master-reference="even-page"/>

                        <fo:conditional-page-master-reference 
blank-or-not-blank="blank"



master-reference="blank-page"/>



</fo:repeatable-page-master-alternatives>
                                </fo:page-sequence-master>
                        </fo:layout-master-set>





        <xsl:template match="chapter">

          <fo:page-sequence master-reference="my-sequence">

                <fo:static-content flow-name="first-before">

                        <fo:block 
xsl:use-attribute-sets="runningHeadPageNumber"



text-align="right"><fo:page-number/>XXX</fo:block>
                </fo:static-content>

            <!-- This code sets up running head for odd pages -->

                <fo:static-content flow-name="odd-before">

                        <fo:block xsl:use-attribute-sets="runningHeadText"

                                                text-align="right">

                                <fo:retrieve-marker 
retrieve-class-name="section" retrieve-position="last-ending-within-page"



retrieve-boundary="document"/>

                                <fo:leader leader-pattern="space" 
leader-length="1em"/>

                                <fo:inline 
xsl:use-attribute-sets="runningHeadPageNumber"><fo:page-number/></fo:inline>

                        </fo:block>

                </fo:static-content>



                <!-- This code sets up running head for even pages -->
                <fo:static-content flow-name="even-before">
                        <fo:block xsl:use-attribute-sets="runningHeadText"
                                                start-indent="-93pt"

keep-together.within-line="always"

                                                text-align="left">

                                <fo:inline 
xsl:use-attribute-sets="runningHeadPageNumber"><fo:page-number/></fo:inline>

                                                <fo:leader 
leader-pattern="space" leader-length="12pt"/>

                                                <fo:retrieve-marker 
retrieve-class-name="chapterTitle" retrieve-position="last-ending-within-page"



retrieve-boundary="document"/>
                        </fo:block>
                </fo:static-content>

                <fo:static-content flow-name="blank-before">

                        <fo:block 
xsl:use-attribute-sets="runningHeadPageNumber"

                                                start-indent="-93pt"



keep-together.within-line="always"



text-align="left"><fo:page-number/>
                        </fo:block>
                </fo:static-content>

                <fo:flow flow-name="xsl-region-body">
                        <fo:block break-before="odd-page" id="{$newId}">
                                <xsl:apply-templates/>
                        </fo:block>
                </fo:flow>
          </fo:page-sequence>
        </xsl:template>

Thanks for all of the help,
Cindy Hunt


-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Thursday, March 29, 2007 12:26 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] XSL-FO page layout question

Cindy,



You're almost there.



Currently, you're flowing your entire content into a single 
page-sequence, as shown here:



At 09:58 AM 3/29/2007, you wrote:
><fo:page-sequence master-reference="my-sequence">
>   <fo:static-content flow-name="first-before"> ... </fo:static-content>
>   <!-- This code sets up running head for odd pages -->
>   <fo:static-content flow-name="odd-before"> ... </fo:static-content>
>   <!-- This code sets up running head for even pages -->
>   <fo:static-content flow-name="even-before"> ... </fo:static-content>
>   <fo:flow flow-name="xsl-region-body">
>      <xsl:apply-templates select="/book/body"/>
>   </fo:flow>
></fo:page-sequence>

Instead, you want each chapter to get its own page sequence. Something like



(where the above appeared)
      <xsl:apply-templates select="/book/body/chapter"/>

and then



<xsl:template match="chapter">
   <fo:page-sequence master-reference="my-sequence">
      ... first, your static contents ...
      then:
      <fo:flow flow-name="xsl-region-body">
        <xsl:apply-templates/>
      </fo:flow>
   </fo:page-sequence>
</xsl:template>

(with adjustments made for the actual structure of your input).



Then each chapter gets its own page sequence and thus its own first page.



You may have to adjust settings on the page-sequence-master to get 
pagination to be continuous, control where the first page appears 
(on an odd or even page), etc.



Cheers,
Wendell


======================================================================

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx

Mulberry Technologies, Inc.                http://www.mulberrytech.com

17 West Jefferson Street                    Direct Phone: 301/315-9635

Suite 207                                          Phone: 301/315-9631

Rockville, MD  20850                                 Fax: 301/315-8285

----------------------------------------------------------------------

   Mulberry Technologies: A Consultancy Specializing in SGML and 
XML ======================================================================




======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent