XSL-FO Study Notes (2)

Source: Internet
Author: User
Tags xsl
XSL-FO Study Notes (2)

This course focuses on the definition of the list, table, multi-page layout, footer header, page encoding, link, and so on in FO.

1. List

The body structure is as follows:

>

main structure
list item definition
label definition
label description
... more item...


<Fo-listblock> the provisional-distance-between-starts Feature Definition of the element <FO: List-item-label> and <FO: the distance between the start part of list-item-body>. The provisional-label-separation feature defines the distance between the end part of <FO: List-item-label> and the start part of <FO: List-item-block>.

<FO: List-item-label> and <FO: the start-indent feature of the list-item-block> element defines from the normal starting margin (the starting position of the section above the List) to <FO: the distance between the start part of list-item-label> or <FO: List-item-body>.


<FO: List-item-label> and <FO: list-item-body> define the end-indent feature of the element from the normal ending margin (the Ending position of the section above the list) the distance between the end of the <FO: List-item-body> element.

Number list <ol>

<FO: List-item-label end-indent = "label-end ()>

<FO: block>

<XSL: number value = "position ()" format = "1."/>

</FO: block>

</FO: List-item-label>

Symbol list <ul>, defining characters with UTF-8

<FO: List-item-label end-indent = "label-end ()>

<FO: block> • </block>

</FO: List-item-label>

For a custom list, the simplest way is to place the term (Label) on a single row and display it in black, and then start the definition of the term (Label) in the next line.

2. Table)

Compare XSL-FO with HTML

XSL-FO Elements HTML Element
<FO: Table> <Table>
<FO: Table-body> <Tbody> (not commonly used)
<FO: Table-column> This information is included in the Cols attribute of the HTML <Table> element.
<FO: Table-row> <Tr>
<FO: Table-cell> <TD>
<FO: Table-caption> <Caption> although the XSL-FO imposes more restrictions on how titles and tables must appear in the source document.

For example:

<FO: Table-layout = "fixed">

<FO: Table-column-width = "150pt"/>

<FO: Table-column-width = "150pt"/>

<FO: Table-body>

<FO: Table-row>

<FO: Table-cell border-style = "solid"

Border-color = "black" border-width = "1pt"

Padding-before = "3pt" padding-after = "3pt"

Padding-Start = "3pt" padding-end = "3pt">

<FO: block> some text </FO: block>

</FO: Table-cell>

<FO: Table-cell border-style = "solid"

Border-color = "black" border-width = "1pt"

Padding-before = "3pt" padding-after = "3pt"

Padding-Start = "3pt" padding-end = "3pt">

<FO: block> some more text </FO: block>

</FO: Table-cell>

</FO: Table-row>

<FO: Table-row>

<FO: Table-cell border-style = "solid"

Border-color = "black" border-width = "1pt"

Padding-before = "3pt" padding-after = "3pt"

Padding-Start = "3pt" padding-end = "3pt">

<FO: block> first cell, last row </FO: block>

</FO: Table-cell>

<FO: Table-cell border-style = "solid"

Border-color = "black" border-width = "1pt"

Padding-before = "3pt" padding-after = "3pt"

Padding-Start = "3pt" padding-end = "3pt">

<FO: block> last cell, last row </FO: block>

</FO: Table-cell>

</FO: Table-row>

</FO: Table-body>

</FO: Table>

Merge Cells

<FO: The number-columns-spanned and number-rows-spanned attributes of table-cell> can be used to combine cells. The value set is a numerical value.

Header

<FO: Table-head> can contain <Table-row>. The following level is <Table-cell>.

Table title, as follows:

<FO: Table-and-caption>

<FO: Table-caption>

...

</FO: Table-caption>

<FO: Table>

...

</FO: Table>

</FO: Table-and-caption>

3. Multi-page layout Sequence

You can use <FO: conditional-page-master-reference> and its master-reference to specify the layout name. Page-position or odd-or-even indicates the page conditions.

<FO: page-sequence-master-name = "standard">

<FO: repeatable-page-master-alternatives>

<FO: conditional-page-master-Reference

Master-reference = "first" Page-position = "first"/>

<FO: conditional-page-master-Reference

Master-reference = "Left" odd-or-even = "even"/>

<FO: conditional-page-master-Reference

Master-reference = "right" odd-or-even = "odd"/>

</FO: repeatable-page-master-alternatives>

</FO: page-sequence-master>

4. Footer Header

You can use The flow-name attribute is XSL-region-before and XSL-region-after, respectively. Generally, <FO: simple-page-master> defines the attributes of a region name. Only the region name (region-name) can be referenced here.

5. Page number

Use <FO: page-number/> and <FO: page-sequence master-reference = "standard" Initial-page-number = "57" format = "I"/> to set the display format (Rome) and start number (57)

6. Links

Adding the ID attribute to any element can generate anchor ). You can use the internal-destination attribute of the FO: Basic-link element to specify the anchor. In this FO: the basic-link element and its end tag are link texts.

Special Page number reference

<FO: page-number-citation> the anchor specified by the ref-ID attribute of the element can be displayed on the page where the anchor is located.

You can use the external-destination attribute of FO: Basic-link to specify links to the web. For example:

<FO: Basic-link color = "blue" external-Destination = "http://hedong.3322.org"> sauteed bamboo </FO: Basic-link>

7. fop extends XSL-FO and provides the "bookmarks" function for defining PDF files.

8. Chinese Character document

Special processing is required for displaying Chinese characters.

1) create a font metrics file, which has different methods for TTC or TTF.

Java org. Apache. fop. fonts. Apps. ttfreader c: \ winnt \ fonts \ simkai. TTF simkai. xml

Java org. Apache. fop. fonts. Apps. ttfreader-ttcname "simsun" C: \ winnt \ fonts \ simsun. TTC simsun. xml

-After ttcname, specify the font name to be extracted from the TTC file. Both commands must be case sensitive.

2) Modify $ fophome/confi/userconfig. XML, and add

<Font metrics-file = "simsun. xml" kerning = "yes" embed-file = "C: \ winnt \ fonts \ simsun. TTC">

<Font-triplet name = "mysimsun" style = "normal" Weight = "normal"/>

</Font>

<Font metrics-file = "simkai. xml" kerning = "yes" embed-file = "C: \ winnt \ fonts \ simkai. TTF">

<Font-triplet name = "mysimkai" style = "normal" Weight = "normal"/>

</Font>

3) Put simkai. xml and simsun. XML in the $ fophome directory because fop. Sh or fop. bat is in this directory. Run

Fop-c conf/userconfig. xml 1.fo 1.pdf

Generation 1.pdf.

4) 1. You can download fo from here. 1. Fo is modified based on reference 2.

References:

1. XSL-FO Advanced Technology

Http://www-900.ibm.com/developerWorks/cn/education/xml/x-xslfo2/tutorial/index.html

2. HowProgramEmbedded in fop

Http://www-900.ibm.com/developerWorks/cn/xml/x-fop/index.shtml

3. fop related technologies

Http://www.javaresearch.org/article/showarticle.jsp? Column = 46 & Thread = 2042

-After ttcname, specify the font name to be extracted from the TTC file. Both commands must be case sensitive. 2) Modify $ fophome/confi/userconfig. xml and add the 1.pdf file before </fonts>.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.