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 Kamal Bhatt <kb...@tt.com.au> on 2007/11/13 21:52:09 UTC

Unexplained space

Hi,
I have a block with another block of text within and within it, I have 
another block of text. I do this to maintain spacing in certain 
circumstances (defined by the XSLT).

Unfortunately one of the sideffects of this is a very large space after 
the enclosed block. If I run the example below in FOP 0.93, I get some 
chunky spacing  after "flight enquiries to check that your aircraft will 
be".

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:str="http://exslt.org/strings"
  xmlns:datetime="http://exslt.org/dates-and-times">
  <fo:layout-master-set>
    <fo:simple-page-master margin-right="7mm" margin-left="7mm" 
margin-bottom="10mm" margin-top="6mm"
      page-height="297mm" page-width="210mm" master-name="A4-first">
      <fo:region-body region-name="itin-body" margin-right="10mm" 
margin-bottom="17mm" margin-top="40mm" />
      <fo:region-before extent="40mm" region-name="itin-before-first" />
      <fo:region-after extent="17mm" region-name="itin-after" />
    </fo:simple-page-master>
    <fo:simple-page-master margin-right="7mm" margin-left="7mm" 
margin-bottom="10mm" margin-top="6mm"
      page-height="297mm" page-width="210mm" master-name="A4-itin">
      <fo:region-body region-name="itin-body" margin-right="10mm" 
margin-bottom="17mm" margin-top="69.9mm" />
      <fo:region-before extent="69.9mm" region-name="itin-before-rest" />
      <fo:region-after extent="17mm" region-name="itin-after" />
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="A4">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference page-position="first" 
master-reference="A4-first" />
        <fo:conditional-page-master-reference page-position="rest" 
master-reference="A4-itin" />
      </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="A4">
    <fo:static-content flow-name="itin-before-first">
      <fo:block>
        <fo:wrapper font-size="37mm">
          <fo:basic-link external-destination="http://www.tt.com.au">
            <fo:external-graphic content-height="37mm" 
src="C:\workspace\FOP\united.jpg" scaling="uniform" />
          </fo:basic-link>
        </fo:wrapper>
      </fo:block>
      <fo:block />
    </fo:static-content>
    <fo:static-content flow-name="itin-before-rest">
      <fo:block>
        <fo:wrapper font-size="37mm">
          <fo:basic-link external-destination="http://www.tt.com.au">
            <fo:external-graphic content-height="37mm" 
src="C:\workspace\FOP\united.jpg" scaling="uniform" />
          </fo:basic-link>
        </fo:wrapper>
      </fo:block>
      <fo:block>
        <fo:table border-bottom-width="1.7mm" 
border-bottom-color="#d6d3cf" border-bottom-style="solid"
          border-top-width="1.7mm" border-top-color="#d6d3cf" 
border-top-style="solid" padding-bottom="3.5mm"
          padding-top="3.5mm" table-layout="fixed" width="100%">
          <fo:table-column column-width="27mm" />
          <fo:table-column column-width="90mm" />
          <fo:table-column column-width="75mm" />
          <fo:table-body font-family="sans-serif" font-size="10pt" 
color="#333" margin-bottom="3mm">
            <fo:table-row>
              <fo:table-cell>
                <fo:block margin-left="3mm">Itinerary for</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block>MR A TEST</fo:block>
                <fo:block>AND PARTY</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:table table-layout="fixed" width="100%">
                  <fo:table-column column-width="50mm" />
                  <fo:table-column column-width="25mm" />
                  <fo:table-body>
                    <fo:table-row>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block border-bottom-color="#333" 
border-bottom-width="thin" border-bottom-style="solid">
                          Booking
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block border-bottom-color="#333" 
border-bottom-width="thin" border-bottom-style="solid"
                          text-align="right">
                          AA/BBBBBBB
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block>Issued</fo:block>
                      </fo:table-cell>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block text-align="right">13 Nov 2007</fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
    </fo:static-content>
    <fo:static-content flow-name="itin-after">
      <fo:block margin-top="5mm">
        <fo:leader rule-thickness="0.05pt" leader-length="195.5mm" 
leader-pattern="rule" />
      </fo:block>
      <fo:table table-layout="fixed" width="100%">
        <fo:table-column column-width="89.5mm" />
        <fo:table-column column-width="120.5mm" />
        <fo:table-body>
          <fo:table-row font-size="9pt">
            <fo:table-cell>
              <fo:block>ABC 123</fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block>
                Page
                <fo:page-number />
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:static-content>
    <fo:flow flow-name="itin-body">
      <fo:block margin-bottom="6.5mm">
        <fo:table border-bottom-width="1.7mm" 
border-bottom-color="#d6d3cf" border-bottom-style="solid"
          border-top-width="1.7mm" border-top-color="#d6d3cf" 
border-top-style="solid" padding-bottom="3.5mm"
          padding-top="3.5mm" table-layout="fixed" width="100%">
          <fo:table-column column-width="27mm" />
          <fo:table-column column-width="90mm" />
          <fo:table-column column-width="75mm" />
          <fo:table-body font-family="sans-serif" font-size="10pt" 
color="#333" margin-bottom="3mm">
            <fo:table-row>
              <fo:table-cell>
                <fo:block margin-left="3mm">Itinerary for</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block>MR A TEST</fo:block>
                <fo:block>AND PARTY</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:table table-layout="fixed" width="100%">
                  <fo:table-column column-width="50mm" />
                  <fo:table-column column-width="25mm" />
                  <fo:table-body>
                    <fo:table-row>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block border-bottom-color="#333" 
border-bottom-width="thin" border-bottom-style="solid">
                          Booking
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block border-bottom-color="#333" 
border-bottom-width="thin" border-bottom-style="solid"
                          text-align="right">
                          GG/219306
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block>Issued</fo:block>
                      </fo:table-cell>
                      <fo:table-cell padding-after="2.2mm">
                        <fo:block text-align="right">13 Nov 2007</fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
      <fo:block font-size="9pt" font-family="HelveticaMonospace" 
color="#333" white-space-treatment="preserve"
        linefeed-treatment="preserve">
        <fo:table table-layout="fixed" width="100%">
          <fo:table-column column-width="11mm" />
          <fo:table-column column-width="16mm" />
          <fo:table-column column-width="169mm" />
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell number-columns-spanned="3">
                <fo:block color="#005F97" font-size="12pt" 
font-family="sans-serif" font-weight="bold"
                  margin-bottom="3mm" border-bottom-width="0.1mm" 
border-bottom-style="solid"
                  border-bottom-color="#005F97">
                  PREPARED ON BEHALF OF ABC 123
                </fo:block>
              </fo:table-cell>
            </fo:table-row>
            <fo:table-row>
              <fo:table-cell>
                <fo:block />
              </fo:table-cell>
              <fo:table-cell number-columns-spanned="2">
                <fo:block linefeed-treatment="preserve" 
margin-bottom="5mm" margin-top="0">                 
                  <fo:block padding="0" margin-bottom="0" 
white-space-collapse="false" white-space-treatment="preserve">  flight 
enquiries to check that your aircraft will be   </fo:block>

departing at the time shown on your ticket and itinerary.

* Baggage weight should not exceed 20 kilograms. For every kilogram over 
the allowance, excess baggage
fees may be charged.

* The standard Australian hotel check-in time is 2:00pm. If you are 
arriving on an early flight, you
may not be able to access your room until this time.

* Upon check-in at your hotel or collection of your rental car, you will 
be asked for either a credit
card imprint or a cash deposit. This is standard procedure and is used 
as a deposit against
incidentals, excess car insurance, etc.

                </fo:block>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

-- 
Kamal Bhatt


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


Re: Unexplained space

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Nov 13, 2007, at 21:52, Kamal Bhatt wrote:

Hi Khamal

> Hi,
> I have a block with another block of text within and within it, I  
> have another block of text. I do this to maintain spacing in  
> certain circumstances (defined by the XSLT).
>
> Unfortunately one of the sideffects of this is a very large space  
> after the enclosed block. If I run the example below in FOP 0.93, I  
> get some chunky spacing  after "flight enquiries to check that your  
> aircraft will be".

The effect you describe is to be expected, I think, if you look at  
this snippet (simply c&p; should be an exact copy of your original):

---
<fo:block linefeed-treatment="preserve" margin-bottom="5mm" margin- 
top="0">                                  <fo:block padding="0"  
margin-bottom="0" white-space-collapse="false" white-space- 
treatment="preserve">  flight enquiries to check that your aircraft  
will be   </fo:block>

departing at the time shown on your ticket and itinerary.
---

The first series of 34 spaces in the outer block will be suppressed.

Note that you have both enabled white-space-preserve and disabled  
white-space-collapse on the inner block. This means that, if FOP  
decides to break the line after the trailing spaces, they will be  
considered relevant when aligning the text "flight enquiries...". Is  
that what you mean by 'chunky space'?
Or is it maybe the effect of the preserved linefeeds in the outer  
block, that generate an empty line, because the second one is the  
only character in that line?

Getting preserved white-space correct can be very tricky. Perhaps you  
wanted this:

---
<fo:block linefeed-treatment="preserve" margin-bottom="5mm" margin- 
top="0"><fo:block padding="0" margin-bottom="0" white-space- 
treatment="preserve">  flight enquiries to check that your aircraft  
will be   </fo:block>departing at the time shown on your ticket and  
itinerary.
---

Do you have control over the stylesheet? In that case, it should be a  
simple matter of adapting the template in question to produce the  
below version.


HTH!

Cheers

Andreas


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