Subject: RE: [xsl] XSL-FO page layout question From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 02 Apr 2007 15:38:21 -0400 |
Good luck, Wendell
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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL-FO control over exter, Abel Braaksma | Thread | RE: [xsl] XSL-FO page layout questi, Cindy Hunt |
Re: [xsl] XSL-FO control over exter, Abel Braaksma | Date | Re: [xsl] need to write multiple br, Wendell Piez |
Month |