XSL-FO 輸出
XSL-FO 在 <fo:flow> 元素內部定義輸出。
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:flow flow-name="xsl-region-body">
<fo:block>
<!-- Output goes here -->
</fo:block>
</fo:flow>
</fo:page-sequence>
XSL-FO 實例
現在讓我們來看一個真實的XSL-FO 實例:
<?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 W3CSchool</fo:block>
</fo:flow>
</fo:page-sequence>
#</fo:root>
<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 W3CSchool</fo:block>
</fo:flow>
</fo:page-sequence>
#</fo:root>
以上程式碼的輸出如下:
Hello W3CSchool