1 / 20

FORMATTING OBJECTS (FO)

FORMATTING OBJECTS (FO). Seminar „XML TECHNOLOGIEN“ Prof. Helmar Burkhart Sitzung vom 26. Juni 2002 Florian Müller. Inhalt: Hauptthemen. Was sind Formatting Objects? 2. Implementierung FOP (Formatting Objects Processor) durch xml.apache.org. Was sind FO?.

leigh-chen
Download Presentation

FORMATTING OBJECTS (FO)

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. FORMATTING OBJECTS (FO) Seminar „XML TECHNOLOGIEN“ Prof. Helmar Burkhart Sitzung vom 26. Juni 2002 Florian Müller

  2. Inhalt: Hauptthemen • Was sind Formatting Objects? • 2. Implementierung FOP (Formatting Objects Processor) durch xml.apache.org

  3. Was sind FO? • Formatting Objects sind ein Bestandteil von XSL. Jeder Tag, der mit „<fo:“ beginnt, ist ein Formatting Object Tag. • Formatting Objects bezeichnen Formateigenschaften von Dokumentteilen (Seiten, Abschnitte, etc.) und Dokumentinhalten (Schrift, Grafiken, Schriftstrukturen wie Tabellen, Listen etc.). •  Spezifische Format-Semantik

  4. Tree Transformation & Formatting • 2 Schritte von einer XML Datei zu gestaltetem Output: • 1. Tree Transformation • Aufbau eines Result Tree aus XML und XSL Source. Result Tree enthält Formatanweisungen (FO, HTML, ...) • 2. Formatting • Interpretation des transformierten Baumes und Senden von Anweisungen an ein Ausgabemedium (Browser, Printer, etc.) • Formatting Objects sind bestimmte Tags aus dem XSL Namespace, die das Format von Inhalten in einem transformierten Baum (Result Tree, 1) ausdrücken.

  5. Output (Browser, Printer, PDF/PS File, etc.) <XML> (SOURCE TREE) <XSL> (Style Information) Parser 1: „Transformer“ Aus XML/XSL wird „RESULT TREE“ (Formatangaben: FO, HTML, etc.) Parser 2: „Formatter“

  6. Transformation nach HTML XML: DATEN <baum> <art>Buche</art> </baum> XSL: DATENDARSTELLUNG <h1>Baumarten</h1> <font style=„color:blue“> <xsl:value-of-select=„baum/art“/> </font> Resultat in HTML: <h1>Baumarten</h1> <font style=„color:blue“> Buche </font> Resultat im Browser: Baumarten Buche

  7. Transformation nach FO XSL: DATENDARSTELLUNG (dieses Mal in FO) <fo:block font-size=„18pt“>Baumarten </fo:block> <fo:block font-color=„blue“> <xsl:value-of-select=„baum/art“/> </fo:block> XML: DATEN <baum> <art>Buche</art> </baum> Resultat in FO: <fo:block font-size=„18pt“> Baumarten</fo:block> <fo:block font-color=„blue“> Buche</fo:block> Resultat nach Formatting: Baumarten Buche

  8. Struktur innerhalb von <fo:root> <fo:root> Beschreibung von Vorlagen Innerhalb <layout-master-set> (Vorlagen) Beschreibung der konkreten Dokument-Inhalte (Daten) </fo:root> • <fo:root> = Wurzelelement jeder FO-Datei

  9. FO: Links, Rechts? top margin top margin end before body body before after left margin left margin start end right margin right margin start after bottom margin bottom margin • Dokument aufgeteilt in 5 Regionen: • Body (~Hauptinhalt) • Start, End (~Seitenkolonnen, z.B. für Randbemerkungen) • Before, After (~Kopf- und Fusszeile) • Richtungsangaben = Schriftrichtung-Sensitiv • LR: Start = links, End = rechts • RL: Start= rechts, End = links • Idem ObenUnten [Before,After]

  10. „Hohe“ FO • <fo:root> • Wurzelelement jeder FO-Datei • <fo:layout-master-set> • Beinhaltet sämtliche „Masters“ (~Vorlagen) einer FO-Datei • <fo:simple-page-master> • Beschreibt gewisse globale Eigenschaften einer Seite oder einer ihrer 5 Teile, Kindobjekt von <fo:layout-master-set> • <fo:page-sequence> • Beschreibt eine konkrete Seite, deren Format durch den referenzierten page-master z.T. vorgegeben wird.

  11. „Niedrige“ FO • <fo:flow> • Ein Flow-Objekt ist direkt einer der 5 Dokumentregionen (body,before,after,start,end) zugeordnet. Es beinhaltet die „Flow“ Objekte eines Dokumentes – Text, Bilder, etc. • <fo:block> • Beinhaltet andere Blocks oder Lines oder direkt Inhalt. • block-progression-direction top  bottom || bottom  top • <fo:inline> • Beinhaltet direkt Inhalt, ~ eine Zeile innerhalb eines Blocks • inline-progression-direction left  right || right  left

  12. FO insgesamt • 56 Formatting Objects • für Master-Vorlagen, konkrete Seiten, Blöcke, Buchstaben, Tabellen, Listen, Fuss- und Kopfnoten, eingebundene Grafiken, Links etc. • 246 Properties • um die Formatting Objects zu spezialisieren: Schrift- und Hintergrundfarben, Schriftfamilie, Schriftgrösse, Ausrichtung, Abstände, Rahmen etc.

  13. Beispiel – ex1.fo • <fo:root> • <fo:layout-master-set> • <fo:simple-page-master master-name=„master1“ margin-top=„1cm“> • <fo:region-body display-align=„before“/> • </fo:simple-page-master> • <fo:simple-page-master master-name=„master2“ margin-top=„10cm“> • <fo:region-body display-align=„before“/> • </fo:simple-page-master> • </fo:layout-master-set> • <fo:page-sequence master-reference=„master1“> • <fo:flow flow-name=„xsl-region-body“> • <fo:block>Finally Information</fo:block> • </fo:flow> • </fo:page-sequence> • <fo:page-sequence master-reference=„master2“> • <fo:flow flow-name=„xsl-region-body“> • <fo:block>Finally Information</fo:block> • </fo:flow> • </fo:page-sequence> • </fo:root>

  14. Anwendungsbeispiel FOP(1) Mission von XML.APACHE.ORG • http://xml.apache.org = XML-Projekt der Apache Gruppe. • Unter anderem nennt das Projekt als eines seiner Ziele: • « robust, full-featured, commercial-quality, and freely available XML support on a wide variety of platforms »

  15. Anwendungsbeispiel FOP(2) Was FOP ist und leistet • FOP (Formatting Objects Processor) = Formatter • XML Source + XSL  Result Tree durch Transformer • Result Tree  Output durch Formatter [FOP] • FOP generiert aus FO- und XML+XSL-Dateien: • pdf, ps,... Binäre Formate • txt, xml, svg,...  ASCII Formate

  16. Anwendungsbeispiel FOP(3) Details • FOP implementiert 39 der 56 Formatting Objects sowie 110 von 246 Formatting Properties. • FOP transformiert FO resp. XML+XSL Dateien nach • PDF (Portable Document Format) • PCL (Hewlett-Packard PCL Printers) • PostScript • Txt (Text only) • SVG (Scalable Vector Graphics) • AT (Area Tree in XML) • Print (Direkte Ausgabe an einen Drucker) • MIF (Maker Interchange Format, für Adobe Framemaker) • AWT (Abstract Windowing Toolkit, viewer only)

  17. Anwendungsbeispiel FOP(4) Beispiele • Beispiel: • FOP mit XML+XSL Input (kein FO Input): • XML Datei mit mehreren Visitenkarten-Einträgen[xml/karte/ex/vorname,nachname,addresse,ort,telefon,email] • XSL Dateien, die diese XML Datei jeweils anders auslesen und die Inhalte mit FO beschreiben

  18. Anwendungsbeispiel FOP(5) Nachteile FOP • Nachteile • Bei weitem nicht die volle Mächtigkeit von XSL-FO wurde implementiert (subset) • Zumindest vorläufig geringe Verfügbarkeit von FO-Dokumenten (müssen selbst erstellt werden, kein Export von z.B. MS Word, Excel, HTML, etc.) • Kein „Reverse Transforming“ (pdf,svg,...  fo)

  19. Anwendungsbeispiel FOP(6) Vorteile FOP • Vision: 1 Grundformat, Transformation in andere Formate „on demand“ und immer mit einem speziellen Zweck (z.B. Unveränderbarkeit, Komprimierung, Interaktivität etc.) • Konsequenzen Beispiel Website: • Nur 1 Informationsdatei je Dokument, die aktualisiert wird (XML) • Nur 1 Styledatei pro Darstellungsform eines Dokuments (XSL) • Durch Generierung on demand: immer neuste Version des Formats (keine „alt-Format-Archive“), geringe Speicherplatzbelegung • Dafür: hohe Prozessorbeanspruchung • Einfache Einführung neuer Formate („plug-in“ im FOP) • Kostenloser Zugang zu PDF

  20. R E S S O U R C E N • http://www.w3.org/TR/xsl • „XSL-aka-FO“ Specification (Chapter 6: Formatting Objects) • http://xml.apache.org/FOP • Apache XML Projekt, • http://www.renderx.com • XEP: kostenpflichtiger FO  PDF Formatter, Alternative zu FOP

More Related