当前位置:K88软件开发文章中心编程语言XmlXSL-FO01 → 文章内容

XSL-FO 块

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-13 11:14:35

XSL-FO 块XSL-FO 的输出位于块区域中。XSL-FO 页面(Page)、流(Flow)以及块(Block)内容"块"会"流"入"页面"中,然后输出到媒介。XSL-FO 输出通常被嵌套在 <fo:block> 元素内,<fo:block> 嵌套于 <fo:flow> 元素内,<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>块区域的属性块是位于矩形框中的输出序列:<fo:block border-width="1mm">This block of output will have a one millimeter border around it.</fo:block>由于块区域是矩形框,所以可共享许多公共的区域属性:space before 和 space aftermarginborderpaddingspace before 和 space after 是块与块之间起分割作用的空白。margin 是块外侧的空白区域。border 是区域外部边缘的矩形。其四个边均可有不同的宽度。它也可被填充为不同的颜色和背景图像。padding 是位于 border 与 content 区域之间的区域。content 区域可包含实际的内容,比如文本、图片、图形等等。块边距(Block Margin)marginmargin-topmargin-bottommargin-leftmargin-right块边框(Block Border)边框样式属性:border-styleborder-before-styleborder-after-styleborder-start-styleborder-end-styleborder-top-style(等同于 border-before)border-bottom-style(等同于 border-after)border-left-style(等同于 border-start)border-right-style(等同于 border-end)边框颜色属性:border-colorborder-before-colorborder-after-colorborder-start-colorborder-end-colorborder-top-color(等同于 border-before)border-bottom-color(等同于 border-after)border-left-color(等同于 border-start)border-right-color(等同于 border-end)边框宽度属性:border-widthborder-before-widthborder-after-widthborder-start-widthborder-end-widthborder-top-width(等同于 border-before)border-bottom-width(等同于 border-after)border-left-width(等同于 border-start)border-right-width(等同于 border-end)块填充(Block Padding)paddingpadding-beforepadding-afterpadding-startpadding-endpadding-top(等同于 padding-before)padding-bottom(等同于 padding-after)padding-left(等同于 padding-start)padding-right(等同于 padding-end)块背景(Block Background)background-colorbackground-imagebackground-repeat background-attachment(scroll 或 fixed)块样式属性(Block Styling Attributes)块是可被单独样式化的输出序列:<fo:blockfont-size="12pt"font-family="sans-serif">This block of output will be written in a 12pt sans-serif font.</fo:block>字体属性:font-familyfont-weightfont-stylefont-sizefont-variant文本属性:text-aligntext-align-lasttext-indentstart-indentend-indent wrap-option(定义自动换行)break-before(定义分页符)break-after(定义分页符)reference-orientation(定义 90" 增量的文字旋转)实例<fo:blockfont-size="14pt" font-family="verdana" color="red"space-before="5mm" space-after="5mm">RUNOOB</fo:block><fo:blocktext-indent="5mm"font-family="verdana" font-size="12pt">At RUNOOB you will find all the Web-building tutorials youneed, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.</fo:block>结果:RUNOOB At RUNOOB you will find all the Web-buildingtutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.请看上面的实例,如果要生成一个拥有许多标题和段落的文档,那么将会需要非常多的代码。通常,XSL-FO 文档不会像我们刚才所做的那样对格式化信息和内容进行组合。通过 XSLT 的些许帮助,我们就可以把格式化信息置入模板,然后编写出更纯净的内容。您会在本教程后面的章节学习到如何使用 XSLT 模板来组合 XSL-FO。

XSL-FO 块