XSL-FO

What is XSL-FO?

  • XSL-FO is a language for formatting XML data
  • XSL-FO stands for Extensible Stylesheet Language Formatting Objects
  • XSL-FO is a W3C Recommendation
  • XSL-FO is now formally named XSL

  • XSLT, a language for transforming XML documents
  • XSL or XSL-FO, a language for formatting XML documents
  • XPath, a language for navigating through elements and attributes in XML documents

XSL-FO Documents

XSL-FO documents are XML files with output information. They contain information about the output layout and output contents.

XSL-FO documents are stored in files with a .fo or a .fob file extension. It is also quite common to see XSL-FO documents stored with an .xml extension, because this makes them more accessible to XML editors.

<? xml version="1.0" encoding="ISO-8859-1" ?>
< fo:root  xmlns:fo ="http://www.w3.org/1999/XSL/Format" >
< fo:layout-master-set >
  
< fo:simple-page-master  master-name ="A4" >
    
<!--  Page template goes here  -->
  
</ fo:simple-page-master >
</ fo:layout-master-set >
< fo:page-sequence  master-reference ="A4" >
  
<!--  Page content goes here  -->
</ fo:page-sequence >
</ fo:root >
XSL-FO Areas
XSL-FO Pages
XSL-FO Regions
XSL-FO Block Areas
XSL-FO Line Areas
XSL-FO Inline Areas
XSL-FO Page, Flow, and Block
<? xml version="1.0" encoding="ISO-8859-1" ?>
< fo:root  xmlns:fo ="http://www.w3.org/1999/XSL/Format" >
< fo:layout-master-set >
  
< fo:simple-page-master  master-name ="A4" >
    
< fo:region-body  />
  
</ fo:simple-page-master >
</ fo:layout-master-set >
< fo:page-sequence  master-reference ="A4" >
  
< fo:flow  flow-name ="xsl-region-body" >
    
< fo:block > Hello W3Schools </ fo:block >
  
</ fo:flow >
</ fo:page-sequence >
</ fo:root >
XSL-FO Page Size
XSL-FO Page Margins
XSL-FO Page Regions
< 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 >
Block Area Attributes
Block Margin
Block Border
Block Padding
Block Background
Block Styling Attributes
< fo:block
    
font-size ="14pt"  font-family ="verdana"  color ="red"
    space-before
="5mm"  space-after ="5mm" >
W3Schools
</ fo:block >
< fo:block
    
text-indent ="5mm"
    font-family
="verdana"  font-size ="12pt"
    space-before
="5mm"  space-after ="5mm" >
At W3Schools 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 List Blocks
XSL-FO Tables

XSL Formatting Objects Reference

The process that converts a description into a presentation is called formatting.

ObjectDescription
basic-linkRepresents the start resource of a link
bidi-overrideOverrides the default Unicode BIDI direction
blockDefines a block of output (e.g. paragraphs and titles)
block-containerDefines a block-level reference-area
characterSpecifies a character that will be mapped to a glyph for presentation
color-profileDefines a color-profile for a stylesheet
conditional-page-master-referenceSpecifies a page-master to be used when the conditions defined are true
declarationsGroups global declarations for a stylesheet
external-graphicUsed for a graphic where the graphics data resides outside of the XML result tree
floatTypically used to position an image in a separate area at the beginning of a page OR to position an image to one side, with the content flowing along-side of the image
flowContains all elements to be printed to a page
footnoteDefines a footnote within the region-body of a page
footnote-bodyDefines the content of the footnote
initial-property-setFormats the first line of an <fo:block>
inlineFormats a part of a text with a background or enclosing it in a border
inline-containerDefines an inline reference-area
instream-foreign-objectUsed for inline graphics or for "generic" objects where the object's data resides as descendants of <fo:instream-foreign-object>
layout-master-setHolds all masters used in a document
leader

Used to generate "." to separate titles from page numbers in table of contents, or to create input fields in forms, or to create horizontal rules

list-blockDefines a list
list-itemContains each item in the list
list-item-bodyContains the content/body of the list-item
list-item-labelContains the label for the list-item (typically a number, character, etc.)
markerUsed with <fo:retrieve-marker> to create running headers or footers
multi-case

Contains (within an <fo:multi-switch>) each alternative sub-tree of XSL-FO objects. The parent <fo:multi-switch> will choose which alternative to show and hide the rest

multi-propertiesUsed to switch between two or more property-sets
multi-property-setSpecifies an alternative property-set that will be applied depending on the state of the user agent
multi-switchHolds one or more <fo:multi-case> objects and controls the switching between them (activated by <fo:multi-toggle>)
multi-toggleUsed to switch to another <fo:multi-case>
page-numberRepresents the current page-number
page-number-citationReferences the page-number for the page that contains the first normal area returned by the cited object
page-sequenceA container for page output elements. There will be one <fo:page-sequence> object for each page layout
page-sequence-masterSpecifies which simple-page-masters are to be used and in which order
region-afterDefines a page footer
region-beforeDefines a page header
region-bodyDefines a page body
region-endDefines the right sidebar of a page
region-startDefines the left sidebar of a page
repeatable-page-master-alternativesSpecifies repetition of a set of simple-page-masters
repeatable-page-master-referenceSpecifies repetition of a single simple-page-master
retrieve-markerUsed with <fo:marker> to create running headers or footers
rootThe root (top) node for XSL-FO documents
simple-page-masterDefines the size and shape of a page
single-page-master-referenceSpecifies a page-master to be used at a given point in the sequence of pages
static-contentContains static content (e.g. headers and footers) that will be repeated on many pages
tableFormats the tabular material of a table
table-and-captionFormats a table and its caption
table-bodyContainer for table rows and table cells
table-captionContains the caption for a table
table-cellDefines a table cell
table-columnFormats the columns of a table
table-footerDefines a table footer
table-headerDefines a table header
table-rowDefines a table row
titleDefines a title for a page-sequence
wrapperSpecifies inherited properties for a group of XSL-FO objects
 
* Reference to W3C Schools
posted on 2007-11-07 17:53 Sady 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/sady/archive/2007/11/07/952421.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值