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 Ralf Steppacher <st...@esteam.de> on 2002/04/17 13:31:49 UTC
Spaces and precedence
Hi all.
I have a short question about spaces and precedences:
What I want is to suppress additional space if one headline directly
follows another.
To achieve this I wrote the template with FOs below but it does not work
(I played a bit with attributes and values and could not find any other
working solution using precendences). Could anybody please tell me
whether my FO is wrong or this is a limitation of FOP?
Thank you in advance!
Ralf
PS.: I know that I might just leave out the space-after of the top level
headline. :-)
<xsl:template match="products">
<fo:block font-family="serif" font-style="normal" font-weight="bold"
font-size="16pt" space-before="50pt" space-after="20pt"
space-after.precedence="0" space-after.minimum="0pt"
id="{@heading}">
<xsl:number count="//*[@heading]" format="1."/>
<xsl:value-of select="./prolog/title"/>
</fo:block>
<xsl:for-each select="./product">
<fo:block font-family="serif" font-style="normal"
font-weight="bold" font-size="12pt"
space-before="30pt" space-after="20pt" id="{@heading}"
space-before.precedence="10"
space-before.minimum="0pt">
<xsl:number count="//*[@heading]" level="multiple"
format="1.1. "/>
<xsl:value-of select="./prolog/title"/>
</fo:block>
<xsl:apply-templates select="product_info"/>
<!-- etc. ... -->
</xsl:for-each>
</xsl:template>
Re: Spaces and precedence
Posted by Ralf Steppacher <st...@esteam.de>.
Hi.
Here is the (pruned) FO I get as an result of my xsl transformation.
What I wanted to do was suppress additional space between two headlines
that directly follow each other.
<fo:flow flow-name="xsl-region-body">
<!-- preceeding blocks -->
<!-- block one -->
<fo:block break-before="page" id="h1_6" space-before="50pt"
space-after="20pt" space-after.precedence="1">
7.Leistungsspektrum
</fo:block>
<!-- block two -->
<fo:block space-before.minimum="0pt" space-before.precedence="2"
id="h2_1" space-after="20pt" space-before="50pt">
7.1 Einzelplatzscanner
</fo:block>
<!-- succeeding blocks -->
</fo:flow>
Block one := A
Block two := B
My understanding of the spec:
A and B are stackable areas, have no borders or padding and are not
reference-areas (block-progression-direction inherited from parent, no
indents specified).
A and B have a block stacking constraint S according to rule 3a. in
chapter 4.2.5
Space Resolution:
S1 := space-after="20pt" precedence="1
S2 := space-before="50pt" precedence="2"
S'' := S1 and S2
In this case: S' == S'' because S'' does not contain line-area traits.
The resolved space-specifier S would suppress S1 because it has a lower
precedence than S2 (point 3 in 4.3.1).
Do I get that right? FOP would not suppress anything and just add all
spaces.
TIA!
Ralf
Re: Spaces and precedence
Posted by "Peter B. West" <pb...@powerup.com.au>.
Joerg,
This is one of the more complex areas of the spec. It took me some time
to work out what it was all for. Arved directed me to an innocuous
little statement near the top of 4.2.5 Stacking Constraints. "The
intention of the definitions is to identify areas at any level of the
tree which have only space between them." The trouble is, that to make
sense of all that follows, and of the term "stacking constraint", you
need to have read the introduction in 4.3 Spaces and Conditionality,
especially in its use of the term "constraint".
I find that thinking of "stacking constraint" as "spaces interaction" or
"spaces stacking interaction" clarifies the discussion for me. That's
why fences are not defined between siblings (the spaces are outside the
padding/borders of each sibling, and so are free to interact), but are
defined between a child and the sibling of its parent (because non-zero
padding/border on the parent will prevent interaction between the spaces
of the child and the parent's sibling.) Similar considerations apply to
reference areas.
I am preparing some notes at the moment on data structures that may be
useful for both space specifier and keep resolution, based on the notes
I posted a few days ago concerning the relationships between blocks, of
which keep processing needed to be aware. I hope to post them in the
next few days, with the diagrams that help to make sense of all this.
Peter
Arved Sandstrom wrote:
>Joerg, it's the diagrams that accompany Section 4.2.5 that make things
>halfway understandable. They have an diagrammed example of each clause.
>
>There are also some key statements in the first paragraph of 4.2.5 - namely,
>that the definitions are recursive, and, that the entire point of the
>definitions is to identify areas that have only spaces between them. So
>actually I was also half-incorrect, because I spoke too hastily; with
>respect to the situation with _siblings_ and their space-after/space-before,
>the borders & padding do _not_ have to have zero width.
>
>Even where borders and padding have non-zero width they may have a
>conditionality of "discard", in which case under certain conditions they
>look like they have zero width for space-resolution purposes.
>
>
>
>
RE: Spaces and precedence
Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
Joerg, it's the diagrams that accompany Section 4.2.5 that make things
halfway understandable. They have an diagrammed example of each clause.
There are also some key statements in the first paragraph of 4.2.5 - namely,
that the definitions are recursive, and, that the entire point of the
definitions is to identify areas that have only spaces between them. So
actually I was also half-incorrect, because I spoke too hastily; with
respect to the situation with _siblings_ and their space-after/space-before,
the borders & padding do _not_ have to have zero width.
Even where borders and padding have non-zero width they may have a
conditionality of "discard", in which case under certain conditions they
look like they have zero width for space-resolution purposes.
Arved
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: April 24, 2002 9:10 PM
> To: fop-user@xml.apache.org
> Subject: Re: Spaces and precedence
>
>
> Arved Sandstrom wrote:
> > Assuming Western reference-orienattion and writing mode, clause 3a of
> > Section 4.2.5 indicates that if the border-after-width and
> padding-after of
> > the first block are zero, and the border-before-width and
> padding-before of
> > the second block are zero, that we have a block-stacking constraint.
> >
> > In which case the precedence on the space-fater of the one and the
> > space-before of the other can be used precisely to achieve this
> collapsing
> > effect.
>
> Thanks for the correction. I'll reread the spec again.
>
> J.Pietschmann
>
>
>
Re: Spaces and precedence
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Arved Sandstrom wrote:
> Assuming Western reference-orienattion and writing mode, clause 3a of
> Section 4.2.5 indicates that if the border-after-width and padding-after of
> the first block are zero, and the border-before-width and padding-before of
> the second block are zero, that we have a block-stacking constraint.
>
> In which case the precedence on the space-fater of the one and the
> space-before of the other can be used precisely to achieve this collapsing
> effect.
Thanks for the correction. I'll reread the spec again.
J.Pietschmann
RE: Spaces and precedence
Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
> -----Original Message-----
> From: Arved Sandstrom [mailto:Arved_37@chebucto.ns.ca]
> Sent: April 24, 2002 6:38 PM
> To: fop-user@xml.apache.org
> Subject: RE: Spaces and precedence
>
>
> > -----Original Message-----
> > From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> > Sent: April 24, 2002 5:17 PM
> > To: fop-user@xml.apache.org
> > Subject: Re: Spaces and precedence
> >
> > Ralf Steppacher wrote:
> > > I have a short question about spaces and precedences:
> > > What I want is to suppress additional space if one headline directly
> > > follows another.
> > >
> > > To achieve this I wrote the template with FOs below but it does
> > not work
> > > (I played a bit with attributes and values and could not find
> any other
> > > working solution using precendences). Could anybody please tell me
> > > whether my FO is wrong or this is a limitation of FOP?
> >
> > After having read the spec several times, i got the impression
> > that space-*.precedence is for prioritizing space reservations
> > coming from stuff from the same area.
> >
> > Roughly:
> > <fo:block space-before="10pt" precedence="1">
> > <fo:block space-before="5pt" precedence="2">
> > stuff
> > ...
> > will put "stuff" 5pt after preceding content.
> >
> > This means, precedence can't be used to collapse space-after
> > and space-before of consecutive blocks.
>
> Assuming Western reference-orienattion and writing mode, clause 3a of
> Section 4.2.5 indicates that if the border-after-width and
> padding-after of
> the first block are zero, and the border-before-width and
> padding-before of
> the second block are zero, that we have a block-stacking constraint.
>
> In which case the precedence on the space-fater of the one and the
> space-before of the other can be used precisely to achieve this collapsing
> effect.
>
> Regards,
> Arved Sandstrom
>
Read "orientation" and "space-after" :-)
"orienattion" is one of my top mistyping words (like "retrun"), but "fater"
is new. :-) Normally I don't have 2 in one post. Drives me nuts.
AHS
RE: Spaces and precedence
Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: April 24, 2002 5:17 PM
> To: fop-user@xml.apache.org
> Subject: Re: Spaces and precedence
>
> Ralf Steppacher wrote:
> > I have a short question about spaces and precedences:
> > What I want is to suppress additional space if one headline directly
> > follows another.
> >
> > To achieve this I wrote the template with FOs below but it does
> not work
> > (I played a bit with attributes and values and could not find any other
> > working solution using precendences). Could anybody please tell me
> > whether my FO is wrong or this is a limitation of FOP?
>
> After having read the spec several times, i got the impression
> that space-*.precedence is for prioritizing space reservations
> coming from stuff from the same area.
>
> Roughly:
> <fo:block space-before="10pt" precedence="1">
> <fo:block space-before="5pt" precedence="2">
> stuff
> ...
> will put "stuff" 5pt after preceding content.
>
> This means, precedence can't be used to collapse space-after
> and space-before of consecutive blocks.
Assuming Western reference-orienattion and writing mode, clause 3a of
Section 4.2.5 indicates that if the border-after-width and padding-after of
the first block are zero, and the border-before-width and padding-before of
the second block are zero, that we have a block-stacking constraint.
In which case the precedence on the space-fater of the one and the
space-before of the other can be used precisely to achieve this collapsing
effect.
Regards,
Arved Sandstrom
Re: Spaces and precedence
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Ralf Steppacher wrote:
> I have a short question about spaces and precedences:
> What I want is to suppress additional space if one headline directly
> follows another.
>
> To achieve this I wrote the template with FOs below but it does not work
> (I played a bit with attributes and values and could not find any other
> working solution using precendences). Could anybody please tell me
> whether my FO is wrong or this is a limitation of FOP?
After having read the spec several times, i got the impression
that space-*.precedence is for prioritizing space reservations
coming from stuff from the same area.
Roughly:
<fo:block space-before="10pt" precedence="1">
<fo:block space-before="5pt" precedence="2">
stuff
...
will put "stuff" 5pt after preceding content.
This means, precedence can't be used to collapse space-after
and space-before of consecutive blocks.
> PS.: I know that I might just leave out the space-after of the top level
> headline. :-)
This is a solution, another one would be to take care of the
conditionality at the XSLT level:
<xsl:template match="products">
<fo:block space-after="20pt" id="{@heading}">
<xsl:number count="//*[@heading]" format="1."/>
<xsl:value-of select="prolog/title"/>
</fo:block>
<xsl:apply-templates select="product"/>
</xsl:template>
<xsl:template match="product">
<fo:block>
<xsl:if test="position()=1">
<xsl:attribute name="space-before">30pt</xsl:attribute>
</xsl:if>
<xsl:number count="//*[@heading]" level="multiple" format="1.1. "/>
<xsl:value-of select="prolog/title"/>
</fo:block>
<xsl:apply-templates select="product_info"/>
<!-- etc. ... -->
</xsl:template>
HTH
J.Pietschmann