当前位置: 首页 > 网络学院 > XML相关教程 > XSL-FO > XSL-FO region-start 对象
The <fo:region-start> object defines the left region of a page (left sidebar).
<fo:region-start>对象定义了页面的左区域(left siderbar)。
XSL-FO uses the following elements to define the regions of a page:
XSL-FO 使用下列元素定义页面区域:
Note: region-before, region-after, region-start, and region-end is a part of the region-body. To avoid text in the region-body to overwrite text in the other regions, the region-body must have margins at least the size of these regions.
注意:region-before、region-after、region-start 以及region-end 都是region-body[主题区域]的一部分。为了避免region-body[主题区域]文本覆盖其它区域的文本, region-body[主题区域]的边距至少必须与上述四个子区域的尺寸相同。
Note: According to version 1.0 of the XSL-FO Recommendation, the padding and border-width properties must be 0.
注意:根据XSL-FO1.0推荐规则来说,页边填充[padding]和边宽[border-width]属性必须为0。
<fo:region-start> <!-- Contents:EMPTY --> </fo:region-start> |
属性 [A-B] | 属性 [C-Z] |
---|---|
background-attachment | clip |
background-color | display-align |
background-image | extent |
background-repeat | overflow |
background-position-horizontal | padding-after |
background-position-vertical | padding-before |
border-after-color | padding-bottom |
border-after-style | padding-end |
border-after-width | padding-left |
border-before-color | padding-right |
border-before-style | padding-start |
border-before-width | padding-top |
border-bottom-color | region-name |
border-bottom-style | reference-orientation |
border-bottom-width | writing-mode |
border-end-color | |
border-end-style | |
border-end-width | |
border-left-color | |
border-left-style | |
border-left-width | |
border-right-color | |
border-right-style | |
border-right-width | |
border-start-color | |
border-start-style | |
border-start-width | |
border-top-color | |
border-top-style | |
border-top-width |
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:region-body margin="5in" /> </fo:simple-page-master> <fo:simple-page-master master-name="left"> <fo:region-body margin-left="2in" margin-right="3in" /> </fo:simple-page-master> <fo:simple-page-master master-name="right"> <fo:region-body margin-left="3in" margin-right="2in" /> </fo:simple-page-master> |
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>元素定义了三个不同的模版。每个模版(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”。它们可以作为奇、偶页面数使用。
This is an extract from an XSL-FO document:
下面列举了XSL-FO文档的一部分:
<fo:simple-page-master master-name="A4" page-width="297mm" page-height="210mm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm"> <fo:region-body margin="3cm"/> <fo:region-before extent="2cm"/> <fo:region-after extent="2cm"/> <fo:region-start extent="2cm"/> <fo:region-end extent="2cm"/> </fo:simple-page-master> |
The code above defines a "Simple Page Master Template" with the name "A4".
上述代码定义了一个名为“A4”的“Simple Page Master Template[简单页面主模版]”。
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.
上述案例中,主题宽度可以通过从页面本身宽度减去左、右边距和region-body[主体区域]的边距来计算。
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.
注意:region-start 和 region-end并不作为计算的一部分。就像我们在前面说的那样,这些区域都是作为主体的一部分的。