xsl blocks, dimensions, size
1. | How to define the dimension of a block |
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 |
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 |
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 |
> 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 |
This is explicitly handled by the "conditionality" component of a space. If you specify a space-before as having a "discard" conditionality, that is,
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 |
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 |
| |
8. | Keeping content together |
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 |
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 |
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. |