W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2004

newbie question - possible to select page-master based on xml attribute?

From: Rebecca Cox <Rebecca.Cox@intergen.co.nz>
Date: Wed, 14 Jul 2004 19:58:30 +1200
Message-ID: <16446983F8930B44BD3D0C296AC99F96312E3F@wlgex3.intergen.org.nz>
To: <www-xsl-fo@w3.org>

I have a problem with selecting page layout types - outlined below, and
would appreciate any advice anyone could give me on this. Even to
confirm whether my assumptions are correct or not, would be really

I'm working on a project where an XSL document is used to transform XML
into xsl:fo, then into PDF - not using any extensions or docbook or
anything. I'm making some sample xml and xsl files and using a wee app
called Felix to do the xml + xsl > xsl:fo, and then a desktop version of
APOC to generate the PDF from xsl:fo.

What I have got is one document with  a series of <chapter> elements -
the first few are some specialised pages (cover page, table of
contents), then there's  a series of <chapter> elements which are in
section cover / section content pairs. 

Sample XML for this:

	<chapter pageType="coverPage"> // only one of these in the
	... Cover page text for the document...

	<chapter pageType="tocPage"> // only one of these in the
	... Table of contents...

	// then a series of chapter coverpage / content pairs:

	<chapter pageType="sectionCoverPage"> 
	... This is a section cover page...

	<chapter pageType="sectionContent">
	... And the section content...


What I want to be able to do, is have a page-master selected and used
for each <chapter>, based on it's value for pageType - for example,
defining the set of page layouts in the XSL something like:

	<fo:simple-page-master master-name="docCover">
	... Definitions...
	<fo:simple-page-master master-name="docToc">
	... Definitions...

	<fo:simple-page-master master-name="chapterCover">
	... Definitions...

	<fo:simple-page-master master-name="chapterPage">
	... Definitions...

From what I've read it isn't possible to assign a simple-page-master
based on content that's in the flow (ie in this case an attribute value)
- it looks as if you can specify which page-master to used based on a
small set of conditions (first page, odd or even, etc), none of which
quite fit here. 

So I am thinking that I'll have to rethink this approach and change the
XML structure - unless there is a way to do what I've outlined above.
(I'm trying to avoid having to change the XML structure as this needs to
be integrated into an existing system - creating new XML elements in my
document would require these to then be integrated into the existing

Any advice on this would be much appreciated,

Rebecca Cox
Received on Wednesday, 14 July 2004 04:00:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:29 UTC