Chris,

I'm afraid I don't agree with you here. You seem to mix up space conditionality and space precedence. See § 4.3 of the spec, and especially § 4.3.1, Space-resolution rules [1] Conditionality only stands for spaces that begin a reference area; as per the first rule, all of the conditional spaces that begin a reference area are discarded. Now for remaining spaces the precedence is to be considered. The space with the highest precedence wins.

In your sample (I have added a space-after for clarity):
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<fo:layout-master-set>
<fo:simple-page-master master-name="a4" page-width="210mm" page-height="297mm" margin="5mm"> <fo:region-body margin-top="90mm" margin-bottom="90mm" background-color="blue"/>
    </fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="a4">
    <fo:flow flow-name="xsl-region-body" font-size="18pt">
        <fo:block space-before="5mm" space-before.conditionality="retain"
space-after="10mm">There should be 5mm of space before this block</fo:block> <fo:block space-before="5mm" space-before.conditionality="discard">There should be 10mm of space before this block
    </fo:block>
    </fo:flow>
</fo:page-sequence>
</fo:root>

The second fo:block does not begin a reference area, so space conditionality isn't taken into consideration. For both spaces, precedence is not specified so the default value of 0 is used (§ 7.10.5 & 7.10.6). The third rule of § 4.3.1 states that between the two spaces of the same precedence, the one that has the highest (optimum) value wins; here the space-after of the first block.

Imagine a scenario where you have many different documents generated by different stylesheets, which all share a common styleset, i.e. an imported XSL file containing xsl:attribute-sets. The styles defined there are used throughout the documents. Now in some documents you might have two adjacent paragraghs that both use styles with space-before="10pt" and after="10pt".

In the document it is desirable only to have 10pt between the paragraphs but how this be achieved? The paragraphs need to use the styles they are using for other reasons. This is where discard comes in handy. Add conditionality="discard" to the two styles and then the space from one gets dropped.

Here we disagree: if I understand the spec correctly this is precedence that should be used, e.g. like in the following: <fo:block space-after="10mm" space-after.precedence="100">There should be 10mm of space after this block</fo:block> <fo:block space-before="10mm" space-before.precedence="200">There should be 10mm of space before this block</fo:block>

Here the space-before of the second block has a higher precedence than the space-after of the first one, and thus wins. The resolved space is 10mm.


>> As per the testcase spaces-block2, I similarly think there should be a
>> space between the first and second block on page 2; anyway, in this
>> case the actual behaviour is probably wrong as the space resolution
>> rules (if I understand them correctly) seems to imply that it should
>> be only 10 points.
>
>
> Yes, that's right there should be less space - not no space.

I think Lucas is right here. The resolved space should be 10pt, that is the optimum space of the two spaces of same value and same precedence. If .minimum and .maximum were specified, the resolved space would take the minimum of the two .minimum values and the max of the two .maximum values for its own .min and .max values.

Do you agree?

Vincent


[1] http://www.w3.org/TR/xsl/slice4.html#area-space

Reply via email to