1 / 17

XSL-FO (Extensible stylesheet Language Formatting Objects)

XSL-FO (Extensible stylesheet Language Formatting Objects). Agenda. Introduction to XSL-FO How XSL-FO works Components of an XSL-FO Document XSL-FO document Important terms to know in page sequence XSL-FO display How using XSL-FO compares to using HTML. Introduction to XSL-FO .

ashtyn
Download Presentation

XSL-FO (Extensible stylesheet Language Formatting Objects)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XSL-FO (Extensible stylesheet Language Formatting Objects)

  2. Agenda • Introduction to XSL-FO • How XSL-FO works • Components of an XSL-FO Document • XSL-FO document • Important terms to know in page sequence • XSL-FO display • How using XSL-FO compares to using HTML

  3. Introduction to XSL-FO • Extensible Stylesheet Language-Formatting Object • A way to make print directly from XML • A page description language (that particular software can read) • XSL-FO rendering software • takes XML as input • Gives PDF, Postscript (RTF,MIF, etc.) as output • Described in a W3C recommendation called XSL(Extensible Stylesheet Language)

  4. How XSL-FO Works

  5. Components of an XSL-FO Document An XSL-FO document has two major parts: 1.Layout master set (layout-master-set), which specifies one or more page master templates (simple-page-master) to be used in the document. - It contains page descriptions (layouts and page masters)General layout of each potential page -Instructions to the rendering engine on which page templates going to use when. 2. It contains page sequences (content flows) -One or more page sequences, which contain the content of the document -It contains page sequences (content flows) -Assign content to pages -Assign formatting styles (properties) to content

  6. XSL-FO Document XSL-FO Document Structure: <?xml version="1.0" encoding="ISO-8859-1"?><fo:rootxmlns: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>

  7. XSL-FO Page Terminology • Pages have a height and width, plus four margins (top, bottom, left, right) • How these properties map to page depends on writing code and orientation

  8. Important Terms to Know for Page-Sequence: • Flow — Flow is the parent element for the data blocks. It determines what region holds what information. • Flow-name — Flow-name defines the region of the page that will display the data and is an attributes to the flow element. • Block — Block is the child element of ‘flow’ that holds the data. Think of a block as a rectangle on a page. Within a block, you can assign white space, borders, backgrounds and fonts

  9. XSL-FO Display • The XSL formatting model defines a number of rectangular areas (boxes) to display output. XSL-FO Areas: • Pages • Regions • Block areas • Line areas • Inline areas

  10. Defining a page using formatting objects Reversed for other languages (egarabic) Typically used for header/footer Block within block

  11. How using XSL-FO compares to using HTML • HTML is one way to display XML • HTML is a vocabulary of tags into which XML can be translated • HTML software (a browser) makes the display from those tags • We know the vocabulary to make the screen effect we want <p>...</p> <b>Wow!</b> <span style="font-style: italic">...</span>

  12. HTML Example • Start with XML-tagged source <recipe> <title>Waffles with Syrup</title> </recipe> • Use XSLT to transform that XML into HTML source <h1>Waffles with Syrup</h1> • And the browser (like IE or Firefox) understands the HTML tags (<h1>) and displays

  13. XSL-FO Example (one more step than in the HTML) • The source XML <recipe> <title>Waffles withSyrup</title> </recipe> • Use XSLT to transform that xml into <fo:block space-after="4pt"> <fo:wrapper font-size="14pt" font-weight="bold"> Waffles with Syrup </fo:wrapper> </fo:block> • Rendering s/w understands the XSL-FO tags and creates PDF • The display engine (like Acrobat) understands the PDF and displays

  14. Skeletal XSL-FO Document • <?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=“skeleton”> • <fo: region-body margin=“1in”/> • <fo: simple-page-master> • </fo: layout-master-set> • <fo: page-sequence master-reference=“skeleton”> • <fo: flow flow-name=“xsl-region-body”> • <fo: block> Howdy, world!</fo: block> • </fo: flow> • <fo: page-sequence> • </fo: root>

  15. CSS Vs XSL-FO CSS XSL-FO Document contains all the content. Allows you to style XML document. Not directly supported by any browsers. XSL-FO lets you insert page numbers • Modifies a document that attached to it. • Allows you to style HTML documents. • CSS is already well-understood by web designers and well-supported by current browsers. • CSS cannot generate dynamic text.

  16. Summary • XSL-FO is used for formatting XML data for various types of media including hard copy printing. • XSL-FO gives lots of control over the final layout of document. • Value of FO-based composition is clear • Lower start-up cost • Lower maintenance cost • Strong XSL-FO community

  17. References • http://www.brainbell.com/tutorials/XML/Working_With_The_XSL-FO_Language.htm • http://www.w3schools.com/xslfo/xslfo_intro.asp • http://www.learn-xsl-fo-tutorial.com/

More Related