[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [xsl-fo] Do a foreach for the number of pages

Subject: Re: [xsl-fo] Do a foreach for the number of pages
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Dec 2011 13:03:27 -0500
Re:  [xsl-fo] Do a foreach for the number of pages
At 2011-12-19 11:58 -0600, Colin DeClue wrote:
So, I was wondering if it was possible to do a foreach for the number
of pages in the document, minus a number provided in the xml.
Basically, I have a flow that I want to end on the last page, rather
than start on the first page. If I could add page breaks for how many
pages the document is minus how many pages the flow is going to take
up, I could easily do this. It does, however, seem like something that
could easily be impossible, since the for-each could impact the number
of pages, and what would the processor do then?

In the XSL-FO specification there is no feedback from the XSL-FO processor back to the transformation you are using to create your XSL-FO instance (typically XSLT but it doesn't have to be). Therefore, you can never know at transformation time how many pages the formatting will take.

You can consider what vendors may offer with their specific products. For example, the RenderX tool has an intermediate format that you can massage between the formatting and the rendering.

Another possibility is to inspect the PDF you create and do a second pass with your input as I do with the "back of the book index" facility I posted for XSLT 1.0 users as a free developer resource on my web site. Using a tool like iText you can count the number of pages in the PDF file and then re-run your transformation with that knowledge.

I hope this helps.

. . . . . . . . . . Ken

Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.