CIS 375—Web App Dev II XSLFO
2 XSLFO IntroductionIntroduction XSLFO stands for Extensible Stylesheet Language ___________________. XSLFO is an _____-based markup language. XSLFO is a W3C Recommendation and is now formally named _____. “XSL” consists of three parts: XSLT (a language for transforming XML documents) XSL (a vocabulary for formatting XML documents) XPath (a language for defining parts of an XML document) This may sound a little confusing, but sometimes life IS a little confusing.
3 XSLFO DocumentsDocuments XSLFO documents are stored in files with a *.fo or a *.____ extension. They can also have the *.____ extension, because this makes them more accessible to XML editors. XSLFO documents start with an XML ___________: The element contains the XSLFO document and declares a namespace. To make XML elements unique, “fo” is given an XML namespace, such as
4 XSLFO Document Structure
5 XSLFO AreasAreas The XSL formatting model defines a number of ___________ areas to display output. One such area is called a _______. Each XSL-FO Page contains a number of _______: region-body, region-before (header), region-after (footer), region-start (left sidebar), and region-end. XSLFO Regions contain _______ areas. XSLFO Block areas most often contain _____ areas. XSLFO Line areas contain _______ areas. XSLFO Inline areas define _____ inside Lines (bullets, single character, graphics, and more).
6 Simple XSLFO Document "Blocks" of content “______" into "Pages" and then to the output media. Hello, world!
7 hello.fo in an XSL Formatter (see
8 XSLFO Flow XSLT-FO pages are filled with ________ from the element. The element contains all the elements to be printed to the page. When the page is full, the same page _______ will be used until all the text is printed. The element has a "flow-name" _______. xsl-region-body (into the region-body) xsl-region-before (into the region-before) xsl-region-after (into the region-after) xsl-region-start (into the region-start) xsl-region-end (into the region-end)
9 XSLFO Pages XSLFO uses page templates called "Page ________" to define the layout of pages. The following illustrates page masters for odd and even page numbers:
10 Example Page Master <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"> Example Page Master
11
12 XSLFO Blocks XSL-FO output is normally nested inside elements, nested inside elements, nested inside elements. Blocks can have many formatting attributes such as, margin, border-width, border-color, padding, background-color, font-family, etc.
13 Example of XSLFO Blocks This code would be placed within the ______ element: <fo:block font-size="14pt" font-family="verdana" color="red" space-before="5mm" space-after="5mm“ padding="2mm"> W3Schools <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.
14 Example from Previous Slide
15 XSLFO List Blocks The following code creates a bulleted list: • Volvo • Saab
16 Example from previous slide:
17 XSLFO Tables The hierarchy of XSLFO table elements (each element contains the listed sub-elements). (optional)
18 XSLFO Table Example Car Price Volvo $50000 SAAB $48000
19 Output from Table Example
20 Generate XSLFO from XML (1) XML document: W3Schools At W3Schools you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.
21 Generate XSLFO from XML (2) XSL document : <xsl:stylesheet version="1.0" xmlns:xsl=" XSL/Transform" xmlns:fo=" XSL/Format"> <fo:simple-page-master master-name="simple" page-width="150mm" page-height="200mm"> <fo:block font-size="14pt" font-family ="verdana" color="red" space-before="5mm" space- after="5mm"> <fo:block font-size="10pt" font-family ="verdana" space-before="5mm" space-after ="5mm">
22 XSLFO from XML Output
23 PDF Output
XSLFO Table w/ XSLT (cd_xslfo.xsl) xmlns:xsl=" xmlns:fo=" <fo:simple-page-master master-name="my-page" page-width="150mm" page-height="200mm"> <fo:block font-size="10pt" font-family ="verdana" color="red" space-before="5mm" space-after="5mm">
25 Output from cd_xslfo.xsl
26 XSLFO Software Special software is required to format XSL documents. This software can produce output as _____