FOP, Help fo:page-number

Here should go questions about transforming XML with XSLT and FOP.
fabiofop
Posts: 3
Joined: Thu Feb 17, 2005 2:41 pm

FOP, Help fo:page-number

Post by fabiofop » Thu Feb 17, 2005 5:44 pm

Hi,

i want display this:

page - number / number of pages
e.g. 1/20

Is it possible by tag
<fo:page-number ?

Thanks & thanks
for any suggestion.
fabio

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Fri Feb 18, 2005 5:32 pm

Hello,

This is a FAQ. See

http://xml.apache.org/fop/faq.html#fo-total-pages

Regards,
Sorin

matchey_m
Posts: 1
Joined: Mon Sep 19, 2016 4:46 pm

Re: FOP, Help fo:page-number

Post by matchey_m » Mon Sep 19, 2016 5:09 pm

Hello,

It is my first post here, so I would like to say hello to everyone and thank for your future help :)
Well, I am looking for a information where should I look for mistake, because I think there is a big wall in front of me, and I really do not know what to do.
The problem is connected with page numbering issue, I would like to publish PDF files always with even number of pages.
I forced this feature in file common-attr.xsl (bolded line)

Code: Select all

 <xsl:attribute-set name="__force__page__count">
<xsl:attribute name="force-page-count">
<xsl:choose>
<xsl:when test="/*[contains(@class, ' bookmap/bookmap ')]">
<xsl:value-of select="'even'"/>
</xsl:when>
<xsl:otherwise>
[b]<xsl:value-of select="'end-on-even'"/>[/b]
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
Then, last page is not taken into counting and the caption looks like that i.e. "12 / 11" [current page / total pages]
If I switch it back to auto mode, I can get proper values of page numbers.


Here are parts of code from custom.xsl file

Code: Select all

<xsl:template match="/" name="rootTemplate">
<xsl:call-template name="validateTopicRefs"/>
<xsl:variable name="fo">
<fo:root xsl:use-attribute-sets="__fo__root">
<xsl:call-template name="createMetadata"/>
<xsl:call-template name="createLayoutMasters"/>
<xsl:call-template name="createBookmarks"/>
<xsl:apply-templates select="*" mode="generatePageSequences"/>
</fo:root>
</xsl:variable>
<xsl:apply-templates select="$fo/*" mode="postprocess"/>
</xsl:template>

<xsl:template match="fo:flow[not(following::fo:flow)]" mode="postprocess">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="postprocess"/>
<fo:block id="last-page-id" keep-with-previous.within-page="always"/>
</xsl:copy>
</xsl:template>

and later in insertBody tamplate

Code: Select all

		
<totalpages>
<fo:page-number-citation-last page-citation-strategy="all" ref-id="last-page-id" />
</totalpages>
Where I should look for solving this issue? I would be very greatful for your help

I use DITA OT 2.2 and DITA 1.3 version

Regards

Manohar_1024
Posts: 47
Joined: Wed Mar 27, 2019 10:12 am

Re: FOP, Help fo:page-number

Post by Manohar_1024 » Fri Nov 15, 2019 12:51 pm

Hello,

I actually want same output like pagenumber 1/20 (total number of pages per chapter).
But i am using DITA with CSS transformation.
So please help me achieving this.

Thank you,
Manohar.

Dan
Posts: 453
Joined: Mon Feb 03, 2003 10:56 am

Re: FOP, Help fo:page-number

Post by Dan » Tue Nov 19, 2019 2:39 pm

For CSS please read:
https://www.oxygenxml.com/doc/versions/ ... aid-title5
Many regards,
Dan

Manohar_1024
Posts: 47
Joined: Wed Mar 27, 2019 10:12 am

Re: FOP, Help fo:page-number

Post by Manohar_1024 » Wed Nov 20, 2019 10:32 am

Hello Dan,

I have read and tried using css that you have suggested. but it is taking number of pages in first chapter as default.
For example :
in chapter 1 : footer- page 2 of 4
in chapter 2: footer- page 2 of 4.
Please help in getting this chapter wise.

Thank you,
Manohar.

Costin
Posts: 695
Joined: Mon Dec 05, 2011 6:04 pm

Re: FOP, Help fo:page-number

Post by Costin » Wed Nov 20, 2019 12:00 pm

Manohar,

Just edit the CSS-based transformation scenario that you are using to obtain the PDF and, in the "Parameters" tab of the scenario editing dialog, look for the "args.css.param.numbering".
Set that parameter's value to "deep-chapter-scope-no-page-reset" and the page numbering should be continuous from the very beginning of the PDF document and all the way down to the end.

You can find more information on the various page numbering variants in the Numbering Types section from the DCPP User-Guide on our website.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Manohar_1024
Posts: 47
Joined: Wed Mar 27, 2019 10:12 am

Re: FOP, Help fo:page-number

Post by Manohar_1024 » Tue Nov 26, 2019 10:13 am

Thanks costin,

But i want both chapterwise page numbering i.e., Page numbers should get reset for chapter and want 1/ Total number of pages for a chapter in the footer.
I am using DITA with CSS transformation.

Thank you,
Manohar.

Costin
Posts: 695
Joined: Mon Dec 05, 2011 6:04 pm

Re: FOP, Help fo:page-number

Post by Costin » Mon Dec 02, 2019 5:03 pm

Hi,

I'm afraid that is not something that could be done.
It is not possible to have contextual counters for current page and for the total pages in each chapter.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Post Reply