xsl blocks, dimensions, size

Blocks

1. How to define the dimension of a block
2. Can I have an fo:inline-block
3. Is fo:block an area-container
4. Is there any way to double space after an fo:block
5. Space-before
6. Margin notes
7. Content in the margin of a block
8. Keeping content together
9. Sidebars, side notes
10. Rotating a block

1.

How to define the dimension of a block

Paul Tchistopolskii


if ('define'=='set explicitly')

   You cannot easily control the absolute dimensions of a
   generic fo:block.  However, there are several objects
   that do have the possibility to specify their dimensions
   explicitly, namely: - fo:inline-graphic and
   fo:display-graphic; - fo:inline-included-container and
   fo:display-included-container.  These four elements have
   'height' and 'width' attributes. For any
   other element, you can control its absolute dimensions by
   placing it inside either of the
   included-containers. There are also more tricky
   techniques.

else if ('define'=='obtain the value of')

   In principle, there exist a mechanism named
   "expressions" (XSL WD p.3.5) that could provide
   for this. But it is still very rudimentary in the current
   draft, and nothing definite can be said at the moment.

            

2.

Can I have an fo:inline-block

Paul Tchistopolskii


Probably fo:inline-included-container is what you mean. It
enables you to put an entire rectangular area (filled with
blocks or whatever other staff) to be placed as an inline
element

            

3.

Is fo:block an area-container

Stephen Deach

Q: Expansion.
Why does the description for fo:block (section 4.4.1 in the current
XSL WD) list writing-mode as one of its properties? An fo:block
supposedly generates a block-area, not an area-container, and section
3.4.6 contains the following sentence:

"A block-area's 'writing-mode" is the same as the writing-mode of the
immediated containing area-container."

answer:

fo:block is NOT an area-container.

However, writing-mode is used by fo:block to determine all the
progression directions and the orientation of start/end/before/after,
but the value can't be changed on fo:block from that on the containing
area-container.

            

4.

Is there any way to double space after an fo:block

Nikolai Grigoriev



> I tried using the space-after attribute <fo:block space-after = "24pt">
> and it didn't work.

In this case, it should. Probably your formatter does not support shorthand notations. Try appending a component qualification to the attribute:

<fo:block space-after.optimum="24pt">
> This leads to how to preserve whitespace... <xsl:preserve-space elements="*"/>
> didn't work.

Same story: all <xsl:*> elements control spaces in the resulting XSL FO file only; these hints don't even arrive to the formatter. White space handling in XSL FO is controlled by a substantial set of specialized properties: "space-treatment", "linefeed-treatment", "white-space-collapse", "wrap-option", and "white-space" (the last is a CSS2 compatibility shorthand).

5.

Space-before

Arved Sandstrom


> A header should have a greater space above then below to look
> esthetic. I can use space-before and space-after attributes to format
> blocks. But if a block starts (I don't know which block) on a new
> page, whatever, simple paragraf or a header, it should not have a
> space-before attribute!
>
> How can I handle this?

This is explicitly handled by the "conditionality" component of a space. If you specify a space-before as having a "discard" conditionality, that is,


space-before.conditionality="discard"

then the space will not take effect at the leading edge of a reference area, as for a new page.

"discard" is actually the default for space-before and space-after.

All your blocks _should_ have the space-before/after attributes, because, as you say, you have no idea which one is going to show up on a new page. Let the .conditionality setting take care of things for you - that's what it is meant for.

6.

Margin notes

David Tolpin




> I'm wondering if anyone has ever done anything with margin
> notes. When I'm searching the internet I often see the term "margin notes"
> but I never see an example of how to do it.

visit RenderX

and search for 'marginalia' . The sample demonstrates how to implement marginalia (margin notes) in XSL FO. The page should have a table of contents or an index, though.

7.

Content in the margin of a block

David Tolpin




> I want to write something in the margin of some block.
> I try to use fo:float, but in this case it's always inside of my text and
not just outside.
> Does anyone has an example?

xep website

8.

Keeping content together

Victor Vishnyakov


> Hello, I am looking for a way to "group" several blocks and 
> only allow a pagebreak after or before such a group.
> Does anyone have a solution or am I going about this in the 
> wrong way? I tried using tables but they did'nt look the way 
> I wanted to.

Use keep-together="always" property to avoid page breaking inside the group. See http://www.w3.org/TR/xsl/slice7.html#keep-together for the details.

E.g.

<fo:block keep-together="always">
	<fo:block>A</fo:block>
	<fo:block>B</fo:block>
	<fo:block>C</fo:block>
</fo:block>

A, B and C will remain on the same page.

9.

Sidebars, side notes

Eliot Kimber


> Hi, I was curious if any of you have tried to do a side bar/note on
> text. Examples would be a column of text with an island of text on
> the side that had a "did you know that" kinda blurb about the main
> column of text. Any suggesstions or ideas would be greatly welcomed.

This can be done with varying degrees of flexibility using side floats. If your notes are always on the same side of the page then it's pretty easy. If you want "inside/outside" notes, where the notes are on the outside edge of the page, it can be more problematic and there may not be a standard way to achieve it in XSL-FO 1.0 or 1.1.

If you just need to use side floats, then it's pretty easy.

10.

Rotating a block

Eliot Kimber


> <fo:block reference-orientation="160"> 
> variable
> </fo:block>

Whether or not FOP supports roation of blocks, this markup is incorrect for two reasons:

Reference orientation must be a multiple of 90 degrees (or zero)

fo:block cannot be rotated, only fo:block-container

Also, when you rotate a block container 90 degrees you should define a constant value for the inline progression dimension (IPD), e.g.:

<fo:block-container
     reference-orientation="90"
     inline-progression-dimension="30mm">
<fo:block>Rotated content goes here</fo:block>
</fo:block-container>

If you don't do this, then the inline progression direction (IPD) is "auto" which means that the content will take all the available space, which would normally result in the content (if it's text), being rendered as a single line taking as many pages as it needs. Probably not what you want.

If the content is a graphic and you set the content-width then you don't need to set the IPD because it's inherent in the content of the block container.

If you want arbitrary rotation of text or graphics you must use something like SVG (or just make it a graphic), where you can rotate things any way you want.