You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Harald Meyer <me...@cybay.de> on 2002/04/24 12:54:30 UTC

page count

Hello,

I want to write something like "page x of y" where y is the number of pages in
my document.
"x" is generated by "<fo:page-number/>" but how do I get "y"??

Harald



Re: Multi-page marker

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Pierre-Yves Chauveau wrote:
> I would like to use a marker that can be retrieved from a different 
> page, ie till I don't get a new title I want the same title rendered in 
> the footer part.
> 
> So I used marker and retrieve marker but I get a NPE

The current implementation can only get markers from the same
page. It's noted somewhere in the documentation distributed
with FOP. It will take some time to get the full spec
implemented.

J.Pietschmann


Multi-page marker

Posted by Pierre-Yves Chauveau <pi...@manpower.fr>.
Hi,
I would like to use a marker that can be retrieved from a different page, ie till I don't get a new title I want the same title rendered in the footer part.
So I used marker and retrieve marker but I get a NPE
If I put retrieve-boundary="page", it works on the first page but on the second page I don't get anything...

Pierre-Yves.

xsl:
   <fo:page-sequence master-reference="all" format="1" initial-page-number="1">
    <!-- zone d'en-tête -->
    <fo:static-content flow-name="xsl-region-before">
     <fo:block text-align="center" font-size="30pt" font-family="serif" font-weight="bold">
      Ordre Client
     </fo:block>
    </fo:static-content>
    <!-- zone de bas de page-->
    <fo:static-content flow-name="xsl-region-after">
     <fo:block text-align="start" font-size="10pt" font-family="serif" line-height="1em + 2pt">
      Title of the book : <fo:retrieve-marker retrieve-class-name="title" retrieve-boundary="page-sequence"/>
      </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
     <xsl:for-each select="book">
      <fo:block break-before="page">
       <xsl:apply-templates select="."/>
      </fo:block>
     </xsl:for-each>
    </fo:flow>
   </fo:page-sequence>
  </fo:root>
 </xsl:template>
 <xsl:template match="book">
  <fo:marker marker-class-name="title"><xsl:value-of select="title"/>
  </fo:marker>
  <fo:list-block provisional-distance-between-starts="47mm" provisional-label-separation="4mm>
   <fo:list-item space-after="2mm">
    <fo:list-item-label>
     <fo:block>Title : </fo:block>
    </fo:list-item-label>
    <fo:list-item-body start-indent="body-start()" end-indent="5mm">
     <fo:block>
      <xsl:value-of select="title"/>
     </fo:block>
    </fo:list-item-body>
   </fo:list-item>
  </fo:list-block>
  <fo:block break-before="page" font-weight="bold" font-size="16pt" border-after-style="solid" border-after-color="blue" border-after-width="2pt" space-after="3mm">
   C'est un beau livre mais dont on ne sait pas la fin  </fo:block> 

Exception     :
---------

javax.xml.transform.TransformerException
        at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1212)
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Unknown Source)
---------
java.lang.NullPointerException
        at org.apache.fop.fo.flow.RetrieveMarker.searchPage(RetrieveMarker.java:89)
        at org.apache.fop.fo.flow.RetrieveMarker.layout(RetrieveMarker.java:70)
        at org.apache.fop.fo.flow.Block.layout(Block.java:262)
        at org.apache.fop.fo.flow.StaticContent.layout(StaticContent.java:79)
        at org.apache.fop.fo.pagination.PageSequence.layoutStaticContent(PageSequence.java:415)
        at org.apache.fop.fo.pagination.PageSequence.formatStaticContent(PageSequence.java:377)
        at org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:304)
        at org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:200)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:182)
        at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:284)
        at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:749)
        at org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.java:495)
        at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:193)
        at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2154)
        at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2097)
        at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2029)
        at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1189)
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Unknown Source)



Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Patrick Lanphier <pm...@artemisgroup.com>.
We are considering using FOP in place of JReports or any other reporting
tools.  More needs to be written on how to use Cocoon and FOP as a true
report writer.  Any help would be great.  I'm currently working with Corda
in hopes that they will change the SVG format to inlining so that it can
be easy used with FOP.  If any of you would like to talk to them about
this that would be great.

Patrick Lanphier
The Artemis Group
http://www.artemisgroup.com
phone: 814-235-0444
  fax: 800-582-9710

On Tue, 30 Apr 2002, J.Pietschmann wrote:

> Patrick Andries wrote:
> > Alex McLintock wrote:
> >> I don't know about an industry analysts study of XSL:FO but we ought
> >> to be able to come up with case studies for people who have
> >> successfully used FOP.
> > I think this is crucial. I found nothing of the sort.
>
> There was recently an announcement on the cocoon list that
> a major NASA site (KSC, i believe) is being redesigned
> using Cocoon 2 (includes FOP) and will going online soon.
> Perhaps some details regarding FOP usage there could be
> asked for.
>
> Apart from this, for my job I found XSLFO superior to
> the various proprietary reporting tools (rather expensive
> stuff). It's just me, though.
>
> J.Pietschmann
>
>
>
>


Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Patrick Andries wrote:
> Alex McLintock wrote:
>> I don't know about an industry analysts study of XSL:FO but we ought 
>> to be able to come up with case studies for people who have 
>> successfully used FOP. 
> I think this is crucial. I found nothing of the sort.

There was recently an announcement on the cocoon list that
a major NASA site (KSC, i believe) is being redesigned
using Cocoon 2 (includes FOP) and will going online soon.
Perhaps some details regarding FOP usage there could be
asked for.

Apart from this, for my job I found XSLFO superior to
the various proprietary reporting tools (rather expensive
stuff). It's just me, though.

J.Pietschmann





Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Patrick Andries <pa...@videotron.ca>.

Alex McLintock wrote:

>
>
> I don't know about an industry analysts study of XSL:FO but we ought 
> to be able to come up with case studies for people who have 
> successfully used FOP. 


I think this is crucial. I found nothing of the sort.



Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Alex McLintock <al...@OWAL.co.uk>.
>On Monday 29 April 2002 13:51, someone wrote:
> > Thank you for all these good ideas. Would anyone happen to know of an
> > industry analyst study on the advantages of XSL FO ?
> > This is to lend some credibility to my recommendation.

At 05:18 30/04/2002, John Austin wrote:
>All of those Open Source developers out there have become a more
>efficient team than Microsoft or anyone else can ever assemble. IBM,
>Sun and a few others seem to have realized this.


I think I agree with John's sentiment, if not his exact phrasing.

I'm trying to either

a) create my own XML publishing system with Cocoon, FOP, Tomcat, XIndice, 
etc and market it myself under my own product name - not mentioning Apache
or
b) try to get enough people in the UK to support Cocoon, FOP, Tomcat, 
XIndice, so that we can put this software into big businesses and they wont 
get nervous about lack of support.

I don't know about an industry analysts study of XSL:FO but we ought to be 
able to come up with case studies for people who have successfully used FOP.


Alex





Openweb Analysts Ltd, London: Software For Complex Websites 
http://www.OWAL.co.uk/
Free Consultancy for London Companies thinking of Open Source Software.


Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by John Austin <jo...@integerservices.no-ip.com>.
On Monday 29 April 2002 13:51, you wrote:
> Thank you for all these good ideas. Would anyone happen to know of an
> industry analyst study on the advantages of XSL FO ?
> This is to lend some credibility to my recommendation.

Well, Gates and his minions are squealing like stuck pigs. Where 
there's smoke there's fire.

Actually, that is the crux of the matter. IMHO, Open Source is yet 
another manifestation of Mecalfe's Law: The utility of a network 
increases as the square of the number of nodes on the network.

All of those Open Source developers out there have become a more 
efficient team than Microsoft or anyone else can ever assemble. IBM, 
Sun and a few others seem to have realized this. Microsoft's 
proprietary approach can't win in this new world, any more than steam 
locomotives could win against diesel-electric (the laws of 
thermodynamics are a bit better-known than Metcalfe's law).

My other example of Metcalfe's Law in action is Sept 11th. Compare the 
information flows of those events with the day of the JFK Assassination 
and the day of the Challenger explosion. Todd Beamer and the other 
passengers on Flight 97 had cell phone nodes to talk to family members 
who had televisions which revealed the hijacker's plans. The network 
gave them the information to make the decision to give their lives to 
save people in Washington DC. Think about that. They were able to make 
that decision in this age of hoaxes, spam, worms and viruses. 



Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Patrick Andries <pa...@videotron.ca>.
Thank you for all these good ideas. Would anyone happen to know of an 
industry analyst study on the advantages of XSL FO ?
This is to lend some credibility to my recommendation.



Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Cyril Rognon <cr...@objectiva.fr>.
Hi Fop-users

I do agree that XML data offer interoperability and many many high feature 
regarding to data tranform and sync and exchange. XSL FO is really a nice 
solution because it helps to build paginated presentation layers that longs 
for a long time.

But I would like to say that FO and other XML subtongues are not here to 
kill proprietary tools. Only format is an issue here. This is why FO can be 
a real good choice. It does not tie you to a tool vendor. Yet it does not 
kill tools, it simply takes care of some part of the job. If a publishing 
tool is only a proprietary format, than FO will make it obsolete but then 
it would only be the proof that the tool had no real added-value. Many 
Publishing tools offer high level publishing option to create, manage and 
maintain content. FO just answer one of the issues : standard paginated 
description. Having a W3C Recomendation is a real superior model in this case.

As for other questions :

the relation between XSL and XSL FO offers a decoupled paginated 
description layer. XSL tells you that tranformation is different from 
Formatting by naming xslt and fo namespaces. They want solution providers 
to keep this in mind in order to offer long term stability and higher level 
publishing model.
  For instance, you can use the page number as a parameter to test if you 
use LaTeX (this is a great language, ver mature. I hope thousnds of 
TeX/LaTeX people will come to work on FO) but it is forbidden in FO. You do 
not programaticaly have acces to the value of the page-number of a specific 
page . So you will have to test something that has some meaning in your XML 
data with xsl. This way, you really have decoupled logic/presentation 
layer. One may see it as a disadvantage but it helps you to focus on each 
layer/logic/responsability level thus allow you to have higher level 
maintenance process...

Ok, enough now, it is kind of difficult to sum this up...

Hope that helps...

Cyril

At 12:59 29/04/2002 +0200, you wrote:
>I do not know the proprietary tools.
>What can I say to you that will convice you?
>The power of standards and open-source.
>Standards allows interoperability. You do not need to buy
>the specs of any closed-source format in order to make a bridge to (let's 
>say) PDF or RTF :-)
>
>Force of the open-source is that improvements in the software
>impacts all the users. Apache httpd is the most significative example
>(or Linux also).
>
>The third problem is that if everyone migrates to FO, the companies behind 
>those proprietary formats will disappear. If you plan to
>use you datas for a long time, it is rather a difficult choice.
>
>At last, using a XML format allows it to get its content from different
>sources. For example, a big usage of XSL:FO is for dynamic PDF creation
>from various (very) different XML sources.
>
>
>Patrick Andries wrote:
>
>>Before convincing people to use specifically, FOP I would like to 
>>convince people that FO is a superior model than traditional model of 
>>proprietary solutions (3B2, Compuset) for documents that both FOP and 
>>those traditional tools can produce.
>>In other words, is FO a good strategic directions.
>>Some questions a bit more precise :
>>1) What are the advantages of people using XSL-FO as page description 
>>language rather than the ones their could be using with proprietary tools ?
>>2) I understand that everything related with XML (XSLT/XSL-FO) has a 
>>modern flavour that few techies can resist, but what are the objectives 
>>reasons ?
>>3) Are they any advantages to FO being integrated with XSLT that the 
>>proprietary tools would not have ?
>>Thanks
>>Does somebody know if any of the big software publishing companies are 
>>considering XSL-FO support ?
>>
>>P. Andries
>>
>>
>>
>>


Re: Why is FO(P) a superior model than what most proprietary tools propose

Posted by Olivier Rossel <ol...@anyware-tech.com>.
I do not know the proprietary tools.
What can I say to you that will convice you?
The power of standards and open-source.
Standards allows interoperability. You do not need to buy
the specs of any closed-source format in order to make a bridge to 
(let's say) PDF or RTF :-)

Force of the open-source is that improvements in the software
impacts all the users. Apache httpd is the most significative example
(or Linux also).

The third problem is that if everyone migrates to FO, the companies 
behind those proprietary formats will disappear. If you plan to
use you datas for a long time, it is rather a difficult choice.

At last, using a XML format allows it to get its content from different
sources. For example, a big usage of XSL:FO is for dynamic PDF creation
from various (very) different XML sources.


Patrick Andries wrote:

> 
> Before convincing people to use specifically, FOP I would like to 
> convince people that FO is a superior model than traditional model of 
> proprietary solutions (3B2, Compuset) for documents that both FOP and 
> those traditional tools can produce.
> 
> In other words, is FO a good strategic directions.
> 
> Some questions a bit more precise :
> 
> 1) What are the advantages of people using XSL-FO as page description 
> language rather than the ones their could be using with proprietary tools ?
> 
> 2) I understand that everything related with XML (XSLT/XSL-FO) has a 
> modern flavour that few techies can resist, but what are the objectives 
> reasons ?
> 
> 3) Are they any advantages to FO being integrated with XSLT that the 
> proprietary tools would not have ?
> 
> Thanks
> 
> Does somebody know if any of the big software publishing companies are 
> considering XSL-FO support ?
> 
> 
> P. Andries
> 
> 
> 
> 
> 
> 
> 
> 
> 



Why is FO(P) a superior model than what most proprietary tools propose

Posted by Patrick Andries <pa...@videotron.ca>.
Before convincing people to use specifically, FOP I would like to 
convince people that FO is a superior model than traditional model of 
proprietary solutions (3B2, Compuset) for documents that both FOP and 
those traditional tools can produce.

In other words, is FO a good strategic directions.

Some questions a bit more precise :

1) What are the advantages of people using XSL-FO as page description language rather than the ones their could be using with proprietary tools ?

2) I understand that everything related with XML (XSLT/XSL-FO) has a modern flavour that few techies can resist, but what are the objectives reasons ?

3) Are they any advantages to FO being integrated with XSLT that the proprietary tools would not have ?

Thanks

Does somebody know if any of the big software publishing companies are considering XSL-FO support ?


P. Andries










Re: page count

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Henrik Holle wrote:
> can you please explain me how to count the page in a fo with an xslt? 

You have to render the XML with a placeholder, count
pages, and render again with the actual number of pages.
FOP provides a method to access the total number of
pages rendered, this allows automation (note: code
can be optimized):

   public static void main(String args[]) {
     try {
       Driver driver =new Driver();
       driver.setOutputStream(new FileOutputStream(args[2]));
       driver.setRenderer(Driver.RENDER_PDF);
       Transformer transformer=TransformerFactory.newInstance()
         .newTransformer(new StreamSource(new File(args[1])));
       transformer.setParameter("page-count","#");
       transformer.transform(new StreamSource(new File(args[0])),
         new SAXResult(driver.getContentHandler()));
       String pageCount=Integer.toString(driver.getResults().getPageCount());
       driver =new Driver();
       driver.setOutputStream(new FileOutputStream(args[2]));
       driver.setRenderer(Driver.RENDER_PDF);
       transformer=TransformerFactory.newInstance().
          newTransformer(new StreamSource(new File(args[1])));
       transformer.setParameter("page-count",pageCount);
       transformer.transform(new StreamSource(new File(args[0])),
          new SAXResult(driver.getContentHandler()));
     }
     catch( Exception e) {
       e.printStackTrace();
     }
   }

A sample XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <xsl:strip-space elements="*"/>
   <xsl:param name="page-count" select="'#'"/>
   <xsl:template match="doc">
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <fo:layout-master-set>
         <fo:simple-page-master master-name="content"
           page-width="210mm" page-height="297mm"
           margin-left="25mm" margin-right="25mm"
           margin-top="25mm" margin-bottom="15mm">
           <fo:region-body margin-bottom="10mm"/>
           <fo:region-after extent="10mm"/>
         </fo:simple-page-master>
       </fo:layout-master-set>
       <fo:page-sequence master-reference="content">
         <fo:static-content flow-name="xsl-region-after">
           <fo:block text-align="end">
             <fo:page-number/>
             <xsl:text> of </xsl:text>
             <xsl:value-of select="$page-count"/>
           </fo:block>
         </fo:static-content>
         <fo:flow flow-name="xsl-region-body">
           <xsl:apply-templates/>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </xsl:template>

   <xsl:template match="sect1">
     <fo:block space-before="12pt">
       <xsl:apply-templates select="title"/>
     </fo:block>
     <fo:block space-before="3pt">
       <xsl:apply-templates select="title/following-sibling::*"/>
     </fo:block>
   </xsl:template>

   <xsl:template match="p">
     <fo:block space-before="3pt">
       <xsl:apply-templates/>
     </fo:block>
   </xsl:template>

</xsl:stylesheet>

Note the parameter page-count.
A sample XML, just for completeness:<?xml version="1.0"?>

<doc>
   <sect1>
     <title>Password</title>
     <p>The users password, as an MD5 hash. The hash is calculated
       as follows: First the password String is converted into an
       UTF8 encoded array of bytes: String.getBytes("UTF8"). The
       MD5 digest is calculated over the given array of bytes and
       stored as a hex string.</p>
   </sect1>
</doc>

HTH
J.Pietschmann


Re: page count

Posted by Chuck Paussa <Ch...@systems.dhl.com>.
Henrik,

Your .fo file is an XML document. So, you need to write an XSL that can 
rewrite the .fo document with some minor changes. Lets say you follow my 
suggestion and your first XSL generates an .fo with <fo:inline 
placeholder="PutTotalPagesHere">1234</fo:inline> in those spots where 
you want the page total. (. . . hmmmmm that is a tough problem isn't it?)

OK. You have to then render the document using FOP because FOP is the 
only thing that's going to know how many pages are rendered. You'll have 
to capture the total number of pages from FOP using that Java variable 
which I saw referred to in a post about 3 weeks ago (anyone?) and then 
rewrite the .fo using an XSL like this. Passing in the value for the 
number of pages as a parameter to your stylesheet. I use saxon and the 
command line is something like

saxon -o output.fo input.fo rewrite.xsl TotalPages=24

There's a Java interface on most XSL processors that allow you to do the 
same thing. (Or, you could dynamically generate this XSL with the number 
of pages embedded)

<?xml version="1.0"?>

<xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        exclude-result-prefixes="fo">
<xsl:output method="xml" version="4.0" omit-xml-declaration="yes" 
indent="yes"/>

<xsl:param name="TotalPages"/>

<xsl:template match="/">
    <xsl:apply-templates mode="output"/>
</xsl:template>

<xsl:template match="*" mode="output">
    <!-- This template outputs the XML document as text -->
    <xsl:element name="{name()}">
        <xsl:for-each select="@*">
            <xsl:attribute name="{name(.)}">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:for-each>
        <xsl:if test="count(./*) &gt; 0">
            <xsl:for-each select=".">
                <xsl:apply-templates mode="output"/>
            </xsl:for-each>
        </xsl:if>
        <xsl:if test="string-length(.) &gt; 0">
            <xsl:if test="count(./*) = 0">
                <xsl:value-of select="."/>
            </xsl:if>
        </xsl:if>
    </xsl:element>
</xsl:template>

<xsl:template match="fo:inline[@placeholder]" mode="output">
    <xsl:value-of select="$TotalPages"/>
</xsl:template>

</xsl:stylesheet>

Chuck Paussa

Henrik Holle wrote:

can you please explain me how to count the page in a fo with an xslt?

 >-----Ursprungliche Nachricht-----
 >Von: Chuck Paussa [mailto:Chuck.Paussa@systems.dhl.com]
 >Henrik,
 >
 >There is no way to do what you want in FO in one pass. What you'll 
need to do is generate the fo: document with some marked up place 
holders in  it. Something like <fo:inline 
placeholder="PutTotalPagesHere"/>. Then run  that document through an 
XSLT transformation that adds up the total  number of pages and replaces 
those special blocks with the information  you want. (You'll see this 
technique referred to in the archives as  "Making a second pass" over 
the document.) You can then use FOP to  generate the output you want.
 >
 >Chuck
 >
 > > Henrik Holle wrote:
 > >
 > > I have various page-sequences in my document:
 > >
 > > <fo:page-sequence master-reference="NameOfMasterReference" 
initial-page-number="1">
 > >
 > > but at the end of the document i need to count the whole pages of 
all page-sequences.
 > >
 > > !<fo:page-number-citation ref-id = "lastBlock"/>! does not work!
 > > -----Ursprungliche Nachricht-----
 > > Von: Ian Taylor [mailto:ian@inatos.com]
 > >
 > > I put this in my <xsl:region-after>
 > >
 > > <fo:block font-size="9pt" line-height="11pt" text-align="end"> Page 
no: <fo:page-number/> of <fo:page-number-citation ref-id = 
"lastBlock"/>  </fo:block> where the last block in the document looks 
like this  <fo:block id = "lastBlock"/>
 > >
 > > Ian
 > > At 12:54 PM 4/24/2002 +0200, you wrote:
 > >
 > > Hello,
 > >
 > > I want to write something like "page x of y" where y is the number 
of pages in my document. "x" is generated by "<fo:page-number/>" but how 
do  I get "y"??
 > >
 > > Harald



Re: Re: page count

Posted by Henrik Holle <hh...@megatel.de>.
can you please explain me how to count the page in a fo with an xslt? 






-----Ursprungliche Nachricht-----
Von: Chuck Paussa [mailto:Chuck.Paussa@systems.dhl.com]
Gesendet: Donnerstag, 25. April 2002 17:03
An: fop-user@xml.apache.org
Betreff: Re: AW: page count


Henrik,

There is no way to do what you want in FO in one pass. What you'll need 
to do is generate the fo: document with some marked up place holders in 
it. Something like <fo:block placeholder="PutTotalPagesHere"/>. Then run 
that document through an XSLT transformation that adds up the total 
number of pages and replaces those special blocks with the information 
you want. (You'll see this technique referred to in the archives as 
"Making a second pass" over the document.) You can then use FOP to 
generate the output you want.

Chuck

 > Henrik Holle wrote:
 >
 > I have various page-sequences in my document:
 >
 > <fo:page-sequence master-reference="NameOfMasterReference" 
initial-page-number="1">
 >
 > but at the end of the document i need to count the whole pages of all 
page-sequences.
 >
 > !<fo:page-number-citation ref-id = "lastBlock"/>! does not work!
 > -----Ursprungliche Nachricht-----
 > Von: Ian Taylor [mailto:ian@inatos.com]
 > Betreff: Re: page count
 >
 > I put this in my <xsl:region-after>
 >
 > <fo:block font-size="9pt" line-height="11pt" text-align="end"> Page 
no: <fo:page-number/> of <fo:page-number-citation ref-id = "lastBlock"/> 
</fo:block> where the last block in the document looks like this 
<fo:block id = "lastBlock"/>
 >
 > Ian
 > At 12:54 PM 4/24/2002 +0200, you wrote:
 >
 > Hello,
 >
 > I want to write something like "page x of y" where y is the number of 
pages in my document. "x" is generated by "<fo:page-number/>" but how do 
I get "y"??
 >
 > Harald





Re: AW: page count

Posted by Chuck Paussa <Ch...@systems.dhl.com>.
Henrik,

There is no way to do what you want in FO in one pass. What you'll need 
to do is generate the fo: document with some marked up place holders in 
it. Something like <fo:block placeholder="PutTotalPagesHere"/>. Then run 
that document through an XSLT transformation that adds up the total 
number of pages and replaces those special blocks with the information 
you want. (You'll see this technique referred to in the archives as 
"Making a second pass" over the document.) You can then use FOP to 
generate the output you want.

Chuck

 > Henrik Holle wrote:
 >
 > I have various page-sequences in my document:
 >
 > <fo:page-sequence master-reference="NameOfMasterReference" 
initial-page-number="1">
 >
 > but at the end of the document i need to count the whole pages of all 
page-sequences.
 >
 > !<fo:page-number-citation ref-id = "lastBlock"/>! does not work!
 > -----Ursprungliche Nachricht-----
 > Von: Ian Taylor [mailto:ian@inatos.com]
 > Betreff: Re: page count
 >
 > I put this in my <xsl:region-after>
 >
 > <fo:block font-size="9pt" line-height="11pt" text-align="end"> Page 
no: <fo:page-number/> of <fo:page-number-citation ref-id = "lastBlock"/> 
</fo:block> where the last block in the document looks like this 
<fo:block id = "lastBlock"/>
 >
 > Ian
 > At 12:54 PM 4/24/2002 +0200, you wrote:
 >
 > Hello,
 >
 > I want to write something like "page x of y" where y is the number of 
pages in my document. "x" is generated by "<fo:page-number/>" but how do 
I get "y"??
 >
 > Harald






AW: page count

Posted by Henrik Holle <hh...@megatel.de>.
I have various page-sequences in my document:

<fo:page-sequence master-reference="NameOfMasterReference"
initial-page-number="1">

but at the end of the document i need to count the whole pages of all
page-sequences.

!<fo:page-number-citation ref-id = "lastBlock"/>! does not work!




-----Ursprungliche Nachricht-----
Von: Ian Taylor [mailto:ian@inatos.com]
Gesendet: Mittwoch, 24. April 2002 13:08
An: fop-user@xml.apache.org
Betreff: Re: page count


I put this in my <xsl:region-after>

<fo:block font-size="9pt" line-height="11pt" text-align="end">
        Page no: <fo:page-number/> of <fo:page-number-citation ref-id =
"lastBlock"/>
</fo:block>

where the last block in the document looks like this

<fo:block id = "lastBlock"/>

Hope this helps

Ian



At 12:54 PM 4/24/2002 +0200, you wrote:

Hello,

I want to write something like "page x of y" where y is the number of pages
in
my document.
"x" is generated by "<fo:page-number/>" but how do I get "y"??

Harald


Re: page count

Posted by Ian Taylor <ia...@inatos.com>.
I put this in my <xsl:region-after>

<fo:block font-size="9pt" line-height="11pt" text-align="end">
         Page no: <fo:page-number/> of <fo:page-number-citation ref-id = 
"lastBlock"/>
</fo:block>

where the last block in the document looks like this

<fo:block id = "lastBlock"/>

Hope this helps

Ian



At 12:54 PM 4/24/2002 +0200, you wrote:
>Hello,
>
>I want to write something like "page x of y" where y is the number of pages in
>my document.
>"x" is generated by "<fo:page-number/>" but how do I get "y"??
>
>Harald