A float is a characteristic of a formatting object that lets it float to a different location on the page. This assumes that the object doesn't have to maintain its strict location in the sequence of text. A figure can move the top or side of a printed page, or the side of an HTML page, and the text can adjust to its new location. If it is to one side, then the text can wrap around the opposite side.
Not all XSL-FO processors support floats. The current version of FOP does not, for example. Other processors may have limitations when handling floats. Check your processor documentation.
Each type of float has a name to indicate its position:
left right start end inside outside before none
These are described in more detail in the section “A sidebar as side float”.
What about floating to the bottom of a printed page? That float location is not part of the XSL-FO 1.0 specification. It could be done using the XSL-FO footnote mechanism, but the DocBook XSL stylesheets don't do that.
You can make a figure
float using any of these methods:
Add a floatstyle
attribute to the figure
element. The floatstyle
attribute was added in version 4.3 of the DocBook DTD. Set the attribute value to the type of float.
Add a float
attribute to the figure
element, and set the attribute value to the type of float. This attribute can be used for all versions of the DTD.
Add a float
attribute to the figure
element, and set the attribute value to 1
. This indicates that the stylesheet should use the value of the default.float.class
parameter as the type of float. That parameter has a
default value of before
(which has no effect in HTML).
Put the figure
element inside a sidebar
element and configure the sidebar as a float. See the section “A sidebar as side float” for more information. Don't include a float
or floatstyle
attribute on the figure
element.
Whatever value you assign to the float
or floatstyle
attribute is used to create the appropriate property in the HTML or print output. When you specify a float for HTML output, it will appear in the HTML as follows:
<div class="figure-float" style="float: left;"> ...
FO output looks something like this:
<fo:float float="left"> <fo:block ...>Figure 1.1. My figure</fo:block> <fo:external-graphic src="url(images/mypicture.png)"/> </fo:float>
For print output, you can also customize how side floats are handled for any element. See the section “Custom side float” for details.
DocBook XSL: The Complete Guide - 3rd Edition | PDF version available | Copyright © 2002-2005 Sagehill Enterprises |