XSL-FO - 多栏页面定义

本文介绍了一个使用XSL-FO实现的两栏页面布局示例,包括具体的XML代码片段。示例展示了如何定义页面的大纲、区域及各部分的样式设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以下是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>

 

 
输出结果
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值