RE: newbie: setting inline widths using FOP?

At 06:37 2002 02 27 +0000, Dave Pawson wrote:
>At 15:55 27/02/2002 -0500, G. Ken Holman wrote:
>>Personally, I just use a three-columned table to do the DSSSL shortcut of left-, right-, centre-
>
>Add this to your comments earlier today to Eliot on xslt list,
>and I'm getting cross. Two instances where we are being forced into using html tricks
>to obtain display formats, using a standard which is supposed to provide them :-|
>
>Issue closed, but since the WG are supposed to be considering new requirements
>for XSL2 (see new charter), Max?
>
>Feature request: Centre left and right header flow objects please.

As pointed out earlier in this thread, the use of "stretchy leaders"
works well to push two blocks to the far left and right of a page.
While one can also use a couple such leaders to get three fields, the 
center field will be off-center to the extent that the contents of the
left and right fields have different lengths.  Hence Ken's reasonable
suggestion to use a three column, one row table.

However, I agree with Dave that that I prefer to avoid using tables just 
to get various side-by-side layouts.  We knew when we designed XSL 1.0
that we could not include special case FOs for all possible side-by-side
situations.

Therefore, I suggest you consider the list FOs in a broader light:
see them as more general side-by-side FOs.  While the result may
not be elegant, true side-by-side FOs aren't going to be a whole
lot simpler, since such layout is inherently complicated.  Better yet,
the list FOs exist and work today.

Specifically, consider the following code to generate left/center/right
fields for a header.  I've made the three fields of equal width that
takes up the entire header width and where the fields butt up against
each other, but it's easy to modify if you want to leave some space.
(I'm making the simplifying assumption that, with the left/center/right 
justification of the three fields, there will always be some space anyway.)
This code also allows for line wrapping when the field content is too
wide to fit into the field on one line.  In this example, I've just put
some nonsense text into the left and right fields and the page number in
the center field, but the field contents can be just about anything.

<fo:static-content flow-name="xsl-region-before">
    <!-- header-width is the width of the full header in picas -->
    <xsl:variable name="header-width" select="36"/>
    <xsl:variable name="header-field-width">
    <xsl:value-of select="$header-width * 0.3333"/><xsl:text>pc</xsl:text>
    </xsl:variable>
    <fo:list-block font-size="8pt" provisional-label-separation="0pt">
        <xsl:attribute name="provisional-distance-between-starts">
            <xsl:value-of select="$header-field-width"/>
        </xsl:attribute>
        <fo:list-item>
            <fo:list-item-label end-indent="label-end()">
                <fo:block text-align="left">
                    <xsl:text>The left header field</xsl:text>
                </fo:block>
            </fo:list-item-label>
            <fo:list-item-body start-indent="body-start()">
                <fo:list-block provisional-label-separation="0pt">
                    <xsl:attribute name="provisional-distance-between-starts">
                        <xsl:value-of select="$header-field-width"/>
                    </xsl:attribute>
                    <fo:list-item>
                        <fo:list-item-label end-indent="label-end()">
                            <fo:block text-align="center">
                                <fo:page-number/>
                            </fo:block>
                        </fo:list-item-label>
                        <fo:list-item-body start-indent="body-start()">
                            <fo:block text-align="right">
                                <xsl:text>The right header field</xsl:text>
                            </fo:block>
                        </fo:list-item-body>
                    </fo:list-item>
                </fo:list-block>
            </fo:list-item-body>
        </fo:list-item>
    </fo:list-block>
</fo:static-content>

paul

Received on Wednesday, 13 March 2002 17:54:44 UTC