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

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
helpful.

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:

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

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


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

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

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

</document>

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:layout-master-set>
	<fo:simple-page-master master-name="docCover">
	... Definitions...
	</fo:simple-page-master>
             
	<fo:simple-page-master master-name="docToc">
	... Definitions...
	</fo:simple-page-master>

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

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

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
system...)

Any advice on this would be much appreciated,

Cheers,
Rebecca Cox

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