W3C home > Mailing lists > Public > www-xsl-fo@w3.org > April 2002

Re: A problem with numbered pages

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Wed, 24 Apr 2002 15:29:49 -0400
Message-Id: <5.1.0.14.0.20020424151953.00b71130@pop1.attglobal.net>
To: <www-xsl-fo@w3.org>
At 2002-04-24 17:52 +0100, Marina Pérel wrote:
>I have a small problem but it will be great if somebody can resolve it.

You are very close to solving it, but you don't realize it.

>     <fo:static-content flow-name="xsl-region-after">
>       page <fo:page-number/> / <fo:page-number-citation ref-id="endofdoc">
>     </fo....>
>     ........
>     ........
>     <fo:block id="endofdoc"> </fo:block>

There is nothing magic about "endofdoc" ... indeed, I think it is 
potentially misleading to be taught that one should use "endofdoc" for this 
purpose.

In my XSLFO book and training I teach that people should not use a fixed 
string but should use something like "{generate-id(/)}" to ensure that 
their end of document indicator is not something that can be accidentally 
included in the area tree by their XML authors accidentally typing the 
value for ID/IDREF purposes.  While I agree "endofdoc" is not very likely 
to show up in an author's content for ID/IDREF, it is statistically 
possible.  By converting every ID/IDREF to using generate-id() of the node 
instead of the ID token (this is the safest approach at all times, 
especially when dealing with multiple source documents), there is no 
statistical probability of every having a conflict, because ID/IDREF cannot 
ever reference the root node of an XML document.

So, just use for each of your included documents:

(1) - a unique "end of included document" identifier (you could easily use 
the generated id of the root node of each of your input documents)
(2) - a separate page sequence with that page sequence's "end of included 
document identifier" being that which you calculate for the included document
(3) - a definition of static content for each page sequence using that 
sequence's unique identifier
(4) - an empty block at the end of each page sequence using that sequence's 
unique identifier
(5) - the initial-page-number="1" property for each page sequence 
(otherwise you will get a cumulative page number)

Don't forget that you are not obliged to use only a single <page-sequence> 
in your XSLFO result ... you can have as many as you need ... each one 
starts on a new page of the result and each one can have different static 
content than the others.

I hope this helps.

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


--
Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO: June 17-21, 2002
-       : 3-days XML Information Modeling: July 31-August 2, 2002

G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:                  2002-05-06,07,09,10,13,20,
-                          06-04,07,10,11,13,14,17,20,07-31,08-05
Received on Wednesday, 24 April 2002 15:34:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:09 GMT