You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jeff Sese <js...@asiatype.com> on 2007/02/14 10:08:20 UTC

Dynamic Running Heads

How do i go about creating dynamic running heads that displays the first 
article in the page and the last article in page; or the only article if 
there is only one article in the page?

page 1:
Title 1
some text
some text
some text
some text
some text

page 2:
some text
some text
Title 2
some text
some text
some text

page 3:
some text
Title 3
some text
some text
some text
some text

page 4:
some text
some text
some text
some text
some text
some text

page 5:
Title 4
some text
some text
some text
Title 5
some text
some text
some text

I want my output to have the following headers for their corresponding page:

page 1: Title 1
page 2: Title 1 - Title 2
page 3: Title 2 - Title 3
page 4: Title 3
page 5: Title 4 - Title 5

Where do i put my markers and how do i retrieve them?

Thanks,
-- 
*Jeff Sese*

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Dynamic Running Heads

Posted by Jeff Sese <js...@asiatype.com>.
Thanks for the explanation.

I've been working with the problem for quite some time now and the 
example i gave was just a simulation of how the original project would 
come out. In the original project though, i have no control over the 
page breaks, is there any way for me the make sure i can avoid the 
situation that you stated below (wherein the page breaks precisely 
between the first and second section)? Would using a keep-with property 
do the trick?

Regards,
*Jeff Sese*

Andreas L Delmelle wrote:
> On Feb 15, 2007, at 04:54, Jeff Sese wrote:
>
> Hi,
>
>> I tested some variations of the position of the markers and the 
>> properties i used for the retrieve-marker, i finally got my desired 
>> output. Here's my fo code for reference:
>> <snip />
>> Basically, I placed a marker that can be read when i specified a 
>> page-boundary of page-sequence. These were place as the first child 
>> of the parent block of the article and the first child of the last 
>> block of the article. Then I placed a marker for the separator and 
>> the title of the current article in the first block child of the main 
>> block, so that it can only be read by a page-boundary of page (I hope 
>> my understanding of the page-boundary property was correct).
>
> Yep, seems about right. Just FYI, to see if you understood it 
> correctly, I'll try to explain a bit more...
>
> The retrieve-boundary property has an initial value of "page-sequence" 
> (= specifying that value is the same as omitting the entire property 
> specification). That value means that *only* markers within the same 
> page-sequence as the retrieve-marker are qualified for retrieval. 
> Setting this to "page" means that any marker that is retrieved, MUST 
> be on the containing page (~ same page as the retrieve-marker).
> So, this property only makes a difference if a given page (or 
> page-sequence) does /not/ contain a marker of the specified 
> marker-class-name:
> * with a retrieve-boundary of "document", even a marker from a page in 
> a preceding page-sequence may be retrieved
> * with a retrieve-boundary of "page-sequence", a marker from a 
> preceding page within the same page-sequence may be retrieved
> * with a retrieve-boundary of "page", there would be no marker to 
> retrieve
>
> Note that markers on pages /following/ the containing page are /never/ 
> qualified for retrieval, whether or not they're in the same 
> page-sequence.
>
> The retrieve-position property, OTOH, indicates a preference for which 
> marker will be retrieved if there's more than one that qualifies based 
> on the retrieve-boundary.
>
> In your example:
> 1) the first page will contain only one marker, namely one of 
> marker-class-name="heading-in-page-sequence", so that one will be 
> retrieved. The other two retrieve-markers retrieve nothing. Due to 
> retrieve-boundary="page", only markers on the containing page qualify.
> 2) the second page contains four markers:
>   * two of marker-class-name="heading-in-page-sequence", so the one 
> that satisfies the preference "first-starting-within-page" is retrieved
>   * one of marker-class-name="heading-separator", so that one is 
> retrieved
>   * one of marker-class-name="heading", so that one is retrieved
> 3) the third page contains four markers: analogous to the second
> 4) the fourth page contains no markers, so only retrieve-markers with 
> a retrieve-boundary other than "page" will actually retrieve anything
>
> Only thing to take care of: in this case, all works nicely, since you 
> control the page-breaks (break-after="page"). Using implicit, 
> formatter-generated page-breaks would make things slightly more 
> difficult.
> If you remove the first explicit break-after, and the formatter would 
> decide to break precisely between the first and second section, your 
> output could turn out to look like:
>
> page 1: first heading
> ...
> page 2: second heading - second heading
> ...
>
> Anyway, thanks for sharing your solution with the list! Always nice to 
> have examples in the archives somewhere.
>
>
> HTH!
>
> Cheers,
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>
> --No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.441 / Virus Database: 268.17.39/687 - Release Date: 
> 2/14/2007 4:17 PM
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Dynamic Running Heads

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Feb 15, 2007, at 04:54, Jeff Sese wrote:

Hi,

> I tested some variations of the position of the markers and the  
> properties i used for the retrieve-marker, i finally got my desired  
> output. Here's my fo code for reference:
> <snip />
> Basically, I placed a marker that can be read when i specified a  
> page-boundary of page-sequence. These were place as the first child  
> of the parent block of the article and the first child of the last  
> block of the article. Then I placed a marker for the separator and  
> the title of the current article in the first block child of the  
> main block, so that it can only be read by a page-boundary of page  
> (I hope my understanding of the page-boundary property was correct).

Yep, seems about right. Just FYI, to see if you understood it  
correctly, I'll try to explain a bit more...

The retrieve-boundary property has an initial value of "page- 
sequence" (= specifying that value is the same as omitting the entire  
property specification). That value means that *only* markers within  
the same page-sequence as the retrieve-marker are qualified for  
retrieval. Setting this to "page" means that any marker that is  
retrieved, MUST be on the containing page (~ same page as the  
retrieve-marker).
So, this property only makes a difference if a given page (or page- 
sequence) does /not/ contain a marker of the specified marker-class- 
name:
* with a retrieve-boundary of "document", even a marker from a page  
in a preceding page-sequence may be retrieved
* with a retrieve-boundary of "page-sequence", a marker from a  
preceding page within the same page-sequence may be retrieved
* with a retrieve-boundary of "page", there would be no marker to  
retrieve

Note that markers on pages /following/ the containing page are / 
never/ qualified for retrieval, whether or not they're in the same  
page-sequence.

The retrieve-position property, OTOH, indicates a preference for  
which marker will be retrieved if there's more than one that  
qualifies based on the retrieve-boundary.

In your example:
1) the first page will contain only one marker, namely one of marker- 
class-name="heading-in-page-sequence", so that one will be retrieved.  
The other two retrieve-markers retrieve nothing. Due to retrieve- 
boundary="page", only markers on the containing page qualify.
2) the second page contains four markers:
   * two of marker-class-name="heading-in-page-sequence", so the one  
that satisfies the preference "first-starting-within-page" is retrieved
   * one of marker-class-name="heading-separator", so that one is  
retrieved
   * one of marker-class-name="heading", so that one is retrieved
3) the third page contains four markers: analogous to the second
4) the fourth page contains no markers, so only retrieve-markers with  
a retrieve-boundary other than "page" will actually retrieve anything

Only thing to take care of: in this case, all works nicely, since you  
control the page-breaks (break-after="page"). Using implicit,  
formatter-generated page-breaks would make things slightly more  
difficult.
If you remove the first explicit break-after, and the formatter would  
decide to break precisely between the first and second section, your  
output could turn out to look like:

page 1: first heading
...
page 2: second heading - second heading
...

Anyway, thanks for sharing your solution with the list! Always nice  
to have examples in the archives somewhere.


HTH!

Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Dynamic Running Heads

Posted by Jeff Sese <js...@asiatype.com>.
Hi,

I tested some variations of the position of the markers and the 
properties i used for the retrieve-marker, i finally got my desired 
output. Here's my fo code for reference:

    <fo:page-sequence master-reference="simple">
        <fo:static-content flow-name="xsl-region-before">
            <fo:block border-bottom-style="solid" 
border-bottom-width="1pt" background-color="gray">
                <fo:retrieve-marker 
retrieve-class-name="heading-in-page-sequence" 
retrieve-boundary="page-sequence" 
retrieve-position="first-starting-within-page"/>
                <fo:retrieve-marker 
retrieve-class-name="heading-separator" retrieve-boundary="page" 
retrieve-position="first-starting-within-page"/>
                <fo:retrieve-marker retrieve-class-name="heading" 
retrieve-boundary="page" retrieve-position="last-ending-within-page"/>
            </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
            <fo:block>
                <fo:marker 
marker-class-name="heading-in-page-sequence">first heading</fo:marker>
                <fo:block text-align="center" font-size="14pt">First 
Heading</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block break-after="page">Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block><fo:marker 
marker-class-name="heading-in-page-sequence">first 
heading</fo:marker>Some text</fo:block>
            </fo:block>
            <fo:block>
                <fo:marker 
marker-class-name="heading-in-page-sequence">second heading</fo:marker>
                <fo:block text-align="center" font-size="14pt">
                    <fo:marker 
marker-class-name="heading-separator">-</fo:marker>
                    <fo:marker marker-class-name="heading">second 
heading</fo:marker>Second Heading</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block break-after="page">Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block><fo:marker 
marker-class-name="heading-in-page-sequence">second 
heading</fo:marker>Some text</fo:block>
            </fo:block>
            <fo:block>
                <fo:marker 
marker-class-name="heading-in-page-sequence">third heading</fo:marker>
                <fo:block text-align="center" font-size="14pt">
                    <fo:marker 
marker-class-name="heading-separator">-</fo:marker>
                    <fo:marker marker-class-name="heading">third 
heading</fo:marker>Third Heading</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block break-after="page">Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block break-after="page">Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block break-after="page"><fo:marker 
marker-class-name="heading-in-page-sequence">third 
heading</fo:marker>Some text</fo:block>
            </fo:block>
            <fo:block>
                <fo:marker 
marker-class-name="heading-in-page-sequence">fourth heading</fo:marker>
                <fo:block text-align="center" font-size="14pt">
                    <fo:marker 
marker-class-name="heading-separator">-</fo:marker>
                    <fo:marker marker-class-name="heading">fourth 
heading</fo:marker>Fourth Heading</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block><fo:marker 
marker-class-name="heading-in-page-sequence">fourth 
heading</fo:marker>Some text</fo:block>
            </fo:block>
            <fo:block>
                <fo:marker 
marker-class-name="heading-in-page-sequence">fifth heading</fo:marker>
                <fo:block text-align="center" font-size="14pt">
                    <fo:marker 
marker-class-name="heading-separator">-</fo:marker>
                    <fo:marker marker-class-name="heading">fifth 
heading</fo:marker>Fifth Heading</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block>Some text</fo:block>
                <fo:block><fo:marker 
marker-class-name="heading-in-page-sequence">fifth 
heading</fo:marker>Some text</fo:block>
            </fo:block>
        </fo:flow>
    </fo:page-sequence>

Basically, I placed a marker that can be read when i specified a 
page-boundary of page-sequence. These were place as the first child of 
the parent block of the article and the first child of the last block of 
the article. Then I placed a marker for the separator and the title of 
the current article in the first block child of the main block, so that 
it can only be read by a page-boundary of page (I hope my understanding 
of the page-boundary property was correct).

Thanks,
*Jeff Sese*


Jeff Sese wrote:
> How do i go about creating dynamic running heads that displays the 
> first article in the page and the last article in page; or the only 
> article if there is only one article in the page?
>
> page 1:
> Title 1
> some text
> some text
> some text
> some text
> some text
>
> page 2:
> some text
> some text
> Title 2
> some text
> some text
> some text
>
> page 3:
> some text
> Title 3
> some text
> some text
> some text
> some text
>
> page 4:
> some text
> some text
> some text
> some text
> some text
> some text
>
> page 5:
> Title 4
> some text
> some text
> some text
> Title 5
> some text
> some text
> some text
>
> I want my output to have the following headers for their corresponding 
> page:
>
> page 1: Title 1
> page 2: Title 1 - Title 2
> page 3: Title 2 - Title 3
> page 4: Title 3
> page 5: Title 4 - Title 5
>
> Where do i put my markers and how do i retrieve them?
>
> Thanks,

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Dynamic Running Heads

Posted by Lo...@log-net.com.
Not 100%, but Chris answered something similar last week: 
http://marc.theaimsgroup.com/?l=fop-user&m=117066981314656&w=2

It is more of how to retrieve the previous page's marker, but it should 
get you going.

If you need a basic marker example, there is one in the distribution under 
examples\fo\markers.

-Lou



Jeff Sese <js...@asiatype.com> wrote on 02/14/2007 04:08:20 AM:

> How do i go about creating dynamic running heads that displays the first 

> article in the page and the last article in page; or the only article if 

> there is only one article in the page?
> 
> page 1:
> Title 1
> some text
> some text
> some text
> some text
> some text
> 
> page 2:
> some text
> some text
> Title 2
> some text
> some text
> some text
> 
> page 3:
> some text
> Title 3
> some text
> some text
> some text
> some text
> 
> page 4:
> some text
> some text
> some text
> some text
> some text
> some text
> 
> page 5:
> Title 4
> some text
> some text
> some text
> Title 5
> some text
> some text
> some text
> 
> I want my output to have the following headers for their corresponding 
page:
> 
> page 1: Title 1
> page 2: Title 1 - Title 2
> page 3: Title 2 - Title 3
> page 4: Title 3
> page 5: Title 4 - Title 5
> 
> Where do i put my markers and how do i retrieve them?
> 
> Thanks,
> -- 
> *Jeff Sese*
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>