XSL-FO Blocks (ບັນທຸກ)
- Previous Page XSLFO Page
- Next Page XSLFO List
ອອກພາບ XSL-FO ຢູ່ໃນເຂດບັນທຸກ.
XSL-FO ບົດບັນບາບ, ການໄຫຼວຽກ ແລະ ບັນທຸກ
ຂັ້ນຕອນ “ບັນທຸກ” ຈະ “ລອຍ”ເຂົ້າໃນ “ເບສຍາຍ” ແລະ ອອກພາບໄປຫາສານລວມ.
XSL-FO ອອກພາບຈະບາງຢູ່ໃນປ່ຽນ່ວຍ <fo:block> ພາຍໃນ <fo:flow> ພາຍໃນ <fo:page-sequence> ພາຍໃນ:
<fo:page-sequence> <fo:flow flow-name="xsl-region-body"> <fo:block> <!-- Output goes here --> </fo:block> </fo:flow> </fo:page-sequence>
Attributes of block area
Block is an output sequence located in a rectangular frame:
<fo:block border-width="1mm"> There is a one-millimeter border around this output block. </fo:block>
Since the block area is a rectangular frame, it can share many common area attributes:
- space before and space after
- margin
- border
- padding
- space before
Illustration:

space before and space after It is the blank area that divides blocks from each other.
margin It is the blank area outside the block.
border The rectangular shape at the outer edge of the area. Its four sides can have different widths. It can also be filled with different colors and background images.
padding It is the area located between the content area and the border.
ContentThe area can contain actual content, such as text, images, graphics, etc.
Block margin
- margin
- margin-top
- margin-bottom
- margin-left
- margin-right
Block border
Attribute of border style:
- style-border
- style-before-border
- style-after-border
- style-left-start-border
- style-right-end-border
- style-upper-top-border (equal to border-before)
- style-lower-bottom-border (equal to border-after)
- style-left-start-border (equal to border-start)
- style-right-end-border (equal to border-end)
Attribute of border color:
- color-border
- color-before-border
- color-after-border
- color-left-start-border
- color-right-end-border
- color-upper-top-border (equal to border-before)
- color-lower-bottom-border (equal to border-after)
- border-left-color (等同于 border-start)
- border-right-color (等同于 border-end)
边框宽度属性:
- border-width
- border-before-width
- border-after-width
- border-start-width
- border-end-width
- border-top-width (等同于 border-before)
- border-bottom-width (等同于 border-after)
- border-left-width (等同于 border-start)
- border-right-width (等同于 border-end)
块填充
- padding
- padding-before
- padding-after
- padding-start
- padding-end
- padding-top (等同于 padding-before)
- padding-bottom (等同于 padding-after)
- padding-left (等同于 padding-start)
- padding-right (等同于 padding-end)
块背景
- background-color
- background-image
- background-repeat
- background-attachment (scroll 或者 fixed)
块样式属性:
块是可被单独样式化的输出序列:
<fo:block font-size="12pt" font-family="sans-serif"> This block of output will be written in a 12pt sans-serif font. </fo:block>
ປະສົມປະກອບຂອງມິດ
- font-family
- font-weight
- font-style
- font-size
- font-variant
ປະສົມປະກອບຂອງມີດ
- text-align
- text-align-last
- text-indent
- start-indent
- end-indent
- wrap-option (ການຈັດການຫົວໜ້າຄຳເວົ້າໄດ້ແບບອັດຕະໂນມັດ)
- break-before (ການຈັດການຫົວໜ້າໜ້າຈັດຕັ້ງເບື້ອງໄປ)
- break-after (define page break, page breaks)
- reference-orientation (define text rotation within 90" )
Example
<fo:block font-size="14pt" font-family="verdana" color="red" space-before="5mm" space-after="5mm"> W3School </fo:block> <fo:block text-indent="5mm" font-family="verdana" font-size="12pt" space-before="5mm" space-after="5mm"> At CodeW3C.com you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP. </fo:block>
结果:

请看上面的例子,如果要生成一个拥有许多标题和段落的文档,那么将会需要非常多的代码。
通常,XSL-FO 文档不会像我们刚才所做的那样对格式化信息和内容进行组合。
With a little help from XSLT, we can put formatting information into the template and then write cleaner content.
You will learn how to use XSLT templates to combine XSL-FO in the later chapters of this tutorial.
- Previous Page XSLFO Page
- Next Page XSLFO List