Re: [xsl] Complex conditional-page-master-reference force last with first

Subject: Re: [xsl] Complex conditional-page-master-reference force last with first
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Feb 2009 20:19:12 -0500
At 2009-02-20 15:35 -0700, Karl Stubsjoen wrote:
Here is the scenario, and will use # of lines to give a feel for the
amount of available real estate for each conditional template:

only - 20 lines
first - 30 lines
any - 40 lines
last - 30 lines


Between 20 and 30 lines of content we have a problem. On 21-29 lines of detail the result is just a first template. Necessary are the summary details on the last page template. So, it is necessary to force the last page, but how?

First I confess I'm not really confident I understand your question at all.


But I *think* you are asking how a one-page formatted document with 21-30 lines would be formatted using the last-page page master rather than the first-page page master.

That would be achieved by ordering your conditional page masters such that the first in document order of conditional elements to test true for 21-30 lines is the one that formats the last page rather than the one that formats the first page:

 <repeatable-page-master-alternatives>
   <conditional-page-master-reference master-reference="frame-only"
                                      page-position="only"/>
   <conditional-page-master-reference master-reference="frame-last"
                                      page-position="last"/>
   <conditional-page-master-reference master-reference="frame-first"
                                      page-position="first"/>
   <conditional-page-master-reference master-reference="frame-other"/>
 </repeatable-page-master-alternatives>

This is because a page with only 21-30 lines satisfies three of the four page masters. Your responsibility as a stylesheet writer is to present the options to the formatter *in the order you want the decision made*. The first page master encountered to fit the criteria will be the one used by the formatter.

There is no obligation for the stylesheet to order the page masters in the order you've cited, but if you've used that order, then the formatter will first be satisfied with the "first" page geometry and won't bother looking at the "any" or "last" page masters.

In the order I've proposed the formatter will be first satisfied with the "last" page master before looking at the "first" or "any" page master. If there are 31 or more lines, then the "last" page master doesn't satisfy the first 30 lines because page-position="last" isn't true when using that page geometry, and it will correctly use the following "first" page master.

I hope I've guessed your requirement correctly and that this helps.

. . . . . . . . . . . Ken


-- Upcoming hands-on XQuery, XSLT, UBL & code list training classes: Brussels, BE 2009-03; Prague, CZ 2009-03, http://www.xmlprague.cz Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread