以下是XSL-FO两栏页面定义的说明和示例代码。
示例代码:
<?xml version="1.0" encoding="UTF-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="page" page-width="8.48in" page-height="10.98in" margin-top="0.4in" margin-bottom="0.4in"> <fo:region-body region-name="xsl-region-body" column-count="2" column-gap="8pt" margin-top="1.2in" margin-bottom="1.2in" margin-left="1in" margin-right="1in" background-color="yellow"/> <fo:region-before region-name="coverpage-region-before" extent="1in" background-color="blue"/> <fo:region-after region-name="coverpage-region-after" extent="1in" background-color="gray"/> <fo:region-start region-name="coverpage-region-start" extent="0.8in" background-color="red"/> <fo:region-end region-name="coverpage-region-end" extent="0.8in" background-color="green"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="page"> <fo:flow flow-name="xsl-region-body"> <fo:block space-before="10pt" space-after="10pt"> This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web. </fo:block> <fo:block space-before="10pt" space-after="10pt"> The system-font function returns a characteristic of a system font. The first argument is the name of the system font and the second argument, which is optional, names the property that specifies the characteristic. If the second argument is omitted, then the characteristic returned is the same as the name of the property to which the expression is being assigned. </fo:block> <fo:block space-before="10pt" space-after="10pt"> The background-color property on the fo:block is assigned the value "red" because the (computed, after inheritance) value of the color (not background-color) property on the fo:list-item-body that is the parent of fo:block is "red". </fo:block> <fo:block space-before="10pt" space-after="10pt"> The from-nearest-specified-value function returns a computed value of the property whose name matches the argument specified, or if omitted for the property for which the expression is being evaluated. The value returned is that for the closest ancestor of the formatting object for which the expression is evaluated on which there is an assignment of the property in the XML result tree in the fo namespace. If there is no such ancestor, the value returned is the initial value. If the argument specifies a shorthand property and if the expression only consists of the from-nearest-specified-value function with an argument matching the property being computed, it is interpreted as an expansion of the shorthand with each property into which the shorthand expands, each having a value of from-nearest-specified-value with an argument matching the property. It is an error if arguments matching a shorthand property are used in any other way. </fo:block> </fo:flow> </fo:page-sequence> </fo:root>
输出结果:
