xsl-list
[Top] [All Lists]

Re: [xsl] XSLT/XSL-FO: How to get a special layout for the first page of every chapter in a book

2009-11-25 14:16:59
On Wed, Nov 25 2009 17:49:21 +0000, martsonjackin(_at_)gmail(_dot_)com wrote:
In my XML document, a new chapters is identified by a <CHAPTER> tag.

Transform each <CHAPTER> to a separate <fo:page-sequence> (containing a
<fo:flow> for the content of the chapter).

I want the first page of every chapter to look different from the rest
of the chapter pages (on the first page I want a bigger region-before
size and the chapter name in region-before, but no chapter name on the
rest of the pages).

As far I understand, the solution may have something to do with
fo:page-sequence-master, it seems to be able to assign a special
page-master to the first page. I understand that I can identify the
first page of the document this way, but how do I identify the first
pages of the rest of the chapters? Don't I somehow have to make it
react whenever a <CHAPTER> tag comes up, by invoking my "page-master
for first pages"? How do I make it react on <CHAPTER> tags?

fo:page-sequence has a 'master-reference' property.  That can refer to
the 'master-name' property of either a fo:simple-page-master or a
fo:page-sequence-master.

If you refer to a fo:simple-page-master, then that's the layout that you
get for all the pages in the page-sequence.

If you refer to a fo:page-sequence-master, then you get to set up the
conditions under which the FO processor will pick particular page
masters.

If it's just the first page that's differerent, then the
fo:page-sequence-master [1] can contain a
fo:single-page-master-reference [2] that refers to the
fo:simple-page-master for the first page followed by a
fo:repeatable-page-master-reference [3] that refers to the
fo:simple-page-master for all the other pages.

You could achieve the same effect with fo:page-sequence-master
containing fo:repeatable-page-master-alternatives containing two
fo:conditional-page-master with different conditions, but it's not
really necessary when you have one page and then the rest all the same.

Regards,


Tony Graham                         
Tony(_dot_)Graham(_at_)MenteithConsulting(_dot_)com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2

[1] http://www.w3.org/TR/xsl11/#fo_page-sequence-master
[2] http://www.w3.org/TR/xsl11/#fo_single-page-master-reference
[3] http://www.w3.org/TR/xsl11/#fo_repeatable-page-master-reference

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>