Reputation: 187
I've seen examples about how to use conditional-page-master-reference to specify which page master to use when the criteria is one of these: blank-or-not-blank, odd-or-even, or page-postion. I was wondering if there's a way to do even more specific conditional page master selection. For example, pages 1-3 use page master A, pages 4-6 use page master B, and pages 7-9 use page master A. This type of criteria doesn't fall within one of the 3 available options in conditional-page-master-reference...also, assume that pages 4-6 were determined to be the pages for master B because of some of the data in the XML. So, is it possible to use the data (XML) as input for criteria for determining the page master to use? Any ideas?
Thanks...
Upvotes: 0
Views: 1920
Reputation: 4393
For example, pages 1-3 use page master A, pages 4-6 use page master B, and pages 7-9 use page master A.
This is done by you specifying the pages in the order desired:
<single-page-master-reference master-reference="A"/>
<single-page-master-reference master-reference="A"/>
<single-page-master-reference master-reference="A"/>
<single-page-master-reference master-reference="B"/>
<single-page-master-reference master-reference="B"/>
<single-page-master-reference master-reference="B"/>
<single-page-master-reference master-reference="A"/>
<single-page-master-reference master-reference="A"/>
<single-page-master-reference master-reference="A"/>
So, is it possible to use the data (XML) as input for criteria for determining the page master to use?
Absolutely, if you are not changing the page master in the middle of a page sequence. If you need to determine the entire page sequence geometry at the time you are starting your page sequence, then your XSLT can simply select the appropriate master-reference= attribute to use.
However, you may be asking about the need some users have of changing page masters in the middle of a page sequence. For example, in technical writing, some users need to switch to a landscape geometry orientation for a single table while in the middle of a portrait page sequence.
In this case, you cannot use XSL-FO without first preprocessing it before interpreting it. To make such preprocessing easy, I've developed the free-to-use PSMI formatting semantic and published it here:
http://CraneSoftwrights.com/resources/#psmi
Many people use PSMI for the use-case I described: they need to dynamically switch page geometries in the middle of the page sequence, which is not allowed in "pure" XSL-FO. So their XSLT creates XSL-FO+PSMI and then they use my free stylesheets to translate XSL-FO+PSMI into pure XSL-FO which then works in any conformant XSL-FO processor.
Upvotes: 2