XSL Formatting Objects don't honor attributes for header or footer in page masters

26 Views Asked by At

Despite any information I found text attributes i n header or footer seem to be ignored.

I stumbled across the problem when trying to add different text alignments for even and odd pages

this is the code I used:

<?xml version="1.0" encoding="UTF-8"?>

<root xmlns="http://www.w3.org/1999/XSL/Format">
    <layout-master-set>
        <!-- Define master for odd pages -->
        <simple-page-master master-name="odd-page" page-width="8.5in" page-height="11in" margin="1in">
            <region-body margin="1in"/>
            <region-before extent="1in"/>
            <region-after extent="1in" text-align="left" text-indent="10%"/>
        </simple-page-master>
        
        <!-- Define master for even pages -->
        <simple-page-master master-name="even-page" page-width="8.5in" page-height="11in" margin="1in">
            <region-body margin="1in"/>
            <region-before extent="1in"/>
            <region-after extent="1in" text-align="right" text-indent="50%"/>
        </simple-page-master>
        
        <!-- Define page sequence master for alternating odd and even pages -->
        <page-sequence-master master-name="main">
            <repeatable-page-master-alternatives>
                <conditional-page-master-reference master-reference="odd-page" odd-or-even="odd"/>
                <conditional-page-master-reference master-reference="even-page" odd-or-even="even"/>
            </repeatable-page-master-alternatives>
        </page-sequence-master>
    </layout-master-set>
    
    <!-- Main page sequence using the page sequence master -->
    <page-sequence master-reference="main">
        <static-content flow-name="xsl-region-before">
            <block>test</block>
        </static-content>
        <static-content flow-name="xsl-region-after">
            <!-- Your footer content goes here -->
            <block>
                Page <page-number-citation ref-id="dummy-id"/>
            </block>
        </static-content>
        <flow flow-name="xsl-region-body">
            <!-- Your content goes here -->
            <block id="dummy-id">Some content...</block>
        </flow>
    </page-sequence>
    <page-sequence master-reference="main">
        <static-content flow-name="xsl-region-before">
            <block>test</block>
        </static-content>
        <static-content flow-name="xsl-region-after">
            <block>
                Page <page-number-citation ref-id="dummy-id2"/>
            </block>
        </static-content>
        <flow flow-name="xsl-region-body">
            <!-- Your content goes here -->
            <block id="dummy-id2">Some content... 2</block>
        </flow>
    </page-sequence></root>

In both cases the footer was left aligned. Did I miss something or is it a problem inside XSL FO

1

There are 1 best solutions below

0
Tony Graham On

You would need to put the text-align and text-indent properties on either the fo:static-content or fo:block for them to work.

Property value inheritance works down the FO tree. It doesn't get reevaluated for each place where the fo:static-content is used. See https://www.w3.org/TR/xsl11/#inheritance

The only exception is that you can use from-page-master-region() to get the writing-mode or reference-orientation value from the applicable page region.