Re: [xep-support] page-number manipulation

From: G. Ken Holman (
Date: Fri Mar 07 2003 - 11:59:28 PST

  • Next message: Lori Wong: "Re: [xep-support] PDF printing problems"

    At 2003-03-07 14:56 +0800, wrote:
    >I had a question previously posted to xsl-list and the answer I got was to
    >use extension features.

    I missed the post on XSL-List and would have commented there. I just found
    the message in an archive, so I will post my answer below to that list as
    well since there will be readers on that list that are not on this
    list. Sorry for the duplication.

    I don't think you need an extension if you are willing to accept a limit.

    >So I want to have your advices about any solution of my problem using XEP.
    >I need to print some horizontal bar on left edge of every pages of a bill
    >statement which is used to be read by folding machine.
    >The folding machine will use these bars to detect some information for the
    >folding processing. (e.g. page sequence, account sequence)
    >Then the machine will fold the pages for one account into an envelope.
    >For each account, I need to specify a page sequence no. for each page.
    >There are four bars, they have values 1, 2, 4 and 8, I can print, and the
    >total of their values should equal to the page sequence no.
    >The page sequence no. start from 1 for page 1 to 15 for page 15, then reset
    >to 1 for page 16 etc.

    I would have thought that page 16 would have zero bars and that page 17
    would have been reset to 1 ... but my solution stands if the answer goes
    either way.

    If you don't mind having some "typically maximum limit" and then
    accommodating an overflow condition ... say you accept a 256 page limit ...
    that no bill will be longer than 256 pages and that if there is one that is
    257 or more pages that you accept the XSL-FO formatter throwing an error to
    signal the pages were not totally completed.

    Create as many <simple-page-master>s as you have combinations of bars (so
    either 15 or 16 based on the answer above ... I'll assume 16). Each
    <simple-page-master> has a different <region-start> name, say "region-0"
    through "region-15".

    Create a <page-sequence-master> with 256 <single-page-master-reference>
    children, in order pointing to masters respectively with
    "region-0",...,"region-15","region-0",...,"region-15", etc.

    Create your <page-sequence> pointing to the <page-sequence-master> and
    including 16 definitions of <static-content> one for each of the 16
    combinations of bars, with absolutely positioned block containers with a
    <leader> rule in each positioned where you want the folding marks.

    Then go ahead and format the document! If there are 257 pages in the one
    bill, the formatter will abend and indicate that it has run out of page
    geometries for the formatting run. But as long as there are enough
    single-page-master-references in your page-sequence-master, it will not
    abend and you will get the pattern of marks in the edge of your paper.

    Yes, it would be cleaner and there would be no limit if there were a
    sub-sequence-repeater object in XSL-FO (how about that as a new requirement
    for version 2?) but if you can accept the maximum page count and I've
    understood your requirement then I think you've got what you need.

    I hope this helps.

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

    Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
                                  North America:      June 16-20, 2003
    G. Ken Holman      
    Crane Softwrights Ltd.
    Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
    ISBN 0-13-065196-6                      Definitive XSLT and XPath
    ISBN 0-13-140374-5                              Definitive XSL-FO
    ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
    ISBN 1-894049-10-1              Practical Formatting Using XSL-FO
    Male Breast Cancer Awareness
    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service

    This archive was generated by hypermail 2.1.5 : Fri Mar 07 2003 - 11:56:35 PST