当前位置: 首页 > 网络学院 > XML相关教程 > XSL-FO > XSL-FO 页面
XSL-FO uses page templates called "Page Masters" to define the layout of pages.
XSL-FO 使用名为 “Page Masters [ 页面主体 ] ” 的页面模板来定义页面的布局。
XSL-FO uses page templates called "Page Masters" to define the layout of pages. Each template must have a unique name:
XSL-FO 使用名为“Page Masters [ 页面主体 ] ” 的页面模板来定义页面的布局。每块模板必须包含一个独立的名称:
<fo:simple-page-master master-name="intro"> <fo:simple-page-master master-name="left"> <fo:simple-page-master master-name="right"> |
In the example above, three <fo:simple-page-master> elements, define three different templates. Each template (page-master) has a different name.
在上述案例中,三个<fo:simple-page-master>元素,定义了三块不同的模板。每块模板都包含不同的名称。
The first template is called "intro". It could be used as a template for introduction pages.
第一块模板称为“intro”,它是用于介绍页面的模板。
The second and third templates are called "left" and "right". They could be used as templates for even and odd page numbers.
第二和第三块模板称作"left" 和 "right"。它们是用于定义奇数页面和偶数页面。
XSL-FO uses the following attributes to define the size of a page:
XSL-FO 使用下述属性来定义页面的尺寸:
XSL-FO uses the following attributes to define the margins of a page:
XSL-FO 用下述属性来定义页面边界:
XSL-FO uses the following elements to define the regions of a page:
XSL-FO 使用以下元素来定义页面的区域:
Note that the region-before, region-after, region-start, and region-end is a part of the body region. To avoid text in the body region to overwrite text in these regions, the body region must have margins at least the size of these regions.
注意:前端区域(region-before),后端区域(region-after),起始区域(region-start),终止区域(region-end)是主体区域的一部分。为了避免文本在主体区域内溢出,主体区域的边界尺寸至少要和上述这些区域一样。
|
This is an extract from an XSL-FO document:
下面列举了一份XSL-FO文档的部分内容:
<fo:simple-page-master master-name="A4" |
The code above defines a "Simple Page Master Template" with the name "A4".
上述代码定义了名称为"A4"的“Simple Page Master”模板。
The width of the page is 297 millimeters and the height is 210 millimeters.
这张页面宽297毫米,高210毫米。
The top, bottom, left, and right margins of the page are all 1 centimeter.
页面的上下左右边界都是1厘米。
The body has a 3 centimeter margin (on all sides).
主体部分的四条边上包含了宽为3厘米的边界。
The before, after, start, and end regions (of the body) are all 2 centimeters.
主体的上下左右部分都是2厘米。
The width of the body in the example above can be calculated by subtracting the left and right margins and the region-body margins from the width of the page itself:
在上述案例中,主体宽度 = 页面自身宽度 - 左右边界宽度 - 区域主体边界宽度,具体如下:
297mm - (2 x 1cm) - (2 x 3cm) = 297mm - 20mm - 60mm = 217mm.
Note that the regions (region-start and region-end) are not a part of the calculation. As described earlier, these regions are parts of the body.
注意:区域(左端区域和右端区域)并不在计算范围之内。如同前面所说的那样,这些区域只是主体的一部分。