SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
XSL:FO
PDFs erstellen mit XML
TOC
1.
2.
3.
4.
5.
6.
7.

Was ist XSL:FO?
Wie sieht es aus?
Der Layout-Master
Die wichtigsten Elemente
Wie wird daraus ein PDF? – Die Prozessoren
Hübsch machen – Geht das?
Linksammlung
Was ist XSL:FO?
Extensible Stylesheet Language Formatting Objects
Teil von XSL
W3C-Standard, published in 2006
Formatierung von XML-Dokumenten für verschiedene Ausgabemedien,
z.B. PDF
Wie sieht es aus?
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
…
</fo:layout-master-set>
<fo:page-sequence>
…
</fo:page-sequence>
</fo:root>
Wie sieht es aus?
XSL:FO muss, wie bei XML-Sprachen üblich, wellformed sein, also
müssen alle geöffneten Blöcke wieder geschlossen werden. Tags, wie z.B.
fo:block können so Block- oder Inline-Elemente sein. Als InlineElemente haben sie jedoch keinen eigenen Inhalt.

fo:block · fo:table · fo:block-container · fo:block · fo:inline-block · fo:st
fo:external-graphic · fo:flow ·
Regionen und der LayoutMaster
Regionen
Regionen sind festgelegte Bereiche einer Page, wie Kopf- und Fußzeile.
Die Regionen und deren Einstellungen. Folgende Regionen gibt es:
region-body (Hauptinhalt)
region-before (Kopfzeile)
region-after (Fußzeile)
region-start (linke Sidebar)
region-end (rechte Sidebar)
Der Layout-Master
Der Layout-Master beschreibt das Grundlayout für eine Seite. Es können
mehrere Master für unterschiedliche Darstellungen in einem Dokument
verwendet werden:
<fo:layout-master-set>
<fo:simple-page-master master-name="A4"
page-height="29.7cm"
page-width="21cm"
margin-top="1.3cm"
margin-bottom="1.8cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="4cm" margin-bottom="1cm" />
<fo:region-before extent="6cm" />
<fo:region-after extent="1.8cm" />
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-start"
page-height="29.7cm"
page-width="21cm"
margin-top="1.3cm"
margin-bottom="2.2cm"
margin-left="1.5cm"
margin-right="1.5cm" >
<fo:region-body margin-top="8cm" margin-bottom="1cm" />
<fo:region-before extent="8cm" />
Die wichtigsten Elemente
fo:page-sequence
<fo:page-sequence master-reference="A4-start">
…
</fo:page-sequence>

Entspricht dem Element section und markiert einen Abschnitt eines
Dokuments, zum Beispiel ein Kapitel. Das Attribute masterreference bezieht sich auf den zu verwendenden Layout-Master.
fo:flow
<fo:flow flow-name="xsl-region-body">
…
</fo:flow>

Der Inhalt einer Page werden in fo:flow eingebettet. Passt der Content
nicht auf eine Seite wird er automatisch auf der nächsten Seite fortgeführt.
Das Attribut flow-name gibt an, in welcher Region der Inhalt angezeigt
wird.
fo:block
<fo:block>
Hello, world!
</fo:block>
<fo:block id="end" />

fo:block entspricht dem div-Container im HTML. Da es keine
eigenen Tags für Absätze, Überschriften oder ähnliches gibt, wird über das
fo:block-Element der Inhalt definiert und gestyled. fo:block als
Inline-Element. Hier ist das Inline-Element mit der id "end" ein Marker,
um festzulegen, dass dies die letzte Seite ist.
Exkurs: Seitennummern
anzeigen
<fo:block>
<fo:page-number /> / <fo:page-number-citation-last ref-id="end" />
</fo:block>
Tabellen
Tabellen sind vom Aufbau her den HTML-Tabellen sehr ähnlich. Der
Inhalt gliedert sich in die drei Bereich fo:table-body, fo:tableheader und fo:table-footer. Wobei fo:table-header und
fo:table-footer immer vor dem fo:table-body definiert
werden.
Tabellen
<fo:table table-layout="fixed" width="12cm">
<fo:table-column column-number="1" column-width="5cm"/>
<fo:table-column column-number="2" column-width="3cm"/>
<fo:table-column column-number="3" column-width="4cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell number-rows-spanned="4">
<fo:block>
<fo:external-graphic src="{{ logo }}" content-width="3.5cm" />
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="2">
<fo:block font-weight="bold">{{ senderAddress.firm }}</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="2" padding-bottom="0.1cm">
<fo:block>{{ senderAddress.street }}</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
Tabellen
Das Attribut table-layout bestimmt, ob die Tabelle eine feste
Spaltenbreite hat, oder diese sich automatisch an den Inhalt anpasst. Unser
derzeitiger Prozessor Apache FOP unterstützt leider nur den Wert fixed,
der eine feste Spaltenbreite erzeugt.
Prozessoren
Mittels Prozessoren wird aus XSL:FO ein gestaltetes Dokument. der
Prozessor ist entscheident für die Möglichkeiten in XSL:FO.
Apache FOP
+ kostenlos
+ wird bei OFCS verwendet
– wird nicht weiterentwickelt
– nur wenig Unterstützung für Darstellungsoptionen
Prozessoren
Antenna House Formatter
– (ziemlich hohe) Lizenzgebühren
+ unterstützt CSS
+ wird weiterentwickelt

Ecrion
– Lizenzgebühren
+ viele Ausgabeformate (PDF, PowerPoint, HTML, Word)
+ wird weiterentwickelt
+ großflächige Unterstützung von weiteren Technologien (Maps, Charts, SVG)
Hübsch machen – geht das?

JEIN

© 2013 Antonia Ilski
Layouts sind nur rudimentär möglich, so wie damals 1999, als Webseiten
noch im table-Layout gestaltet wurden. Jedes Element unterstützt
verschiedene Gestaltungsattribute, um etwas aufgehübscht zu werden.

background-attachment · border-before-color · border-before-style · border-be

padding-after · font-family · font-size · font-style · font-weight · margin-t
start-indent · relative-position · display-align · … ·
Linksammlung
W3C
W3Schools
Apache FOP

Weitere ähnliche Inhalte

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

xsl:fo

  • 2. TOC 1. 2. 3. 4. 5. 6. 7. Was ist XSL:FO? Wie sieht es aus? Der Layout-Master Die wichtigsten Elemente Wie wird daraus ein PDF? – Die Prozessoren Hübsch machen – Geht das? Linksammlung
  • 3. Was ist XSL:FO? Extensible Stylesheet Language Formatting Objects Teil von XSL W3C-Standard, published in 2006 Formatierung von XML-Dokumenten für verschiedene Ausgabemedien, z.B. PDF
  • 4. Wie sieht es aus? <?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> … </fo:layout-master-set> <fo:page-sequence> … </fo:page-sequence> </fo:root>
  • 5. Wie sieht es aus? XSL:FO muss, wie bei XML-Sprachen üblich, wellformed sein, also müssen alle geöffneten Blöcke wieder geschlossen werden. Tags, wie z.B. fo:block können so Block- oder Inline-Elemente sein. Als InlineElemente haben sie jedoch keinen eigenen Inhalt. fo:block · fo:table · fo:block-container · fo:block · fo:inline-block · fo:st fo:external-graphic · fo:flow ·
  • 6. Regionen und der LayoutMaster
  • 7. Regionen Regionen sind festgelegte Bereiche einer Page, wie Kopf- und Fußzeile. Die Regionen und deren Einstellungen. Folgende Regionen gibt es: region-body (Hauptinhalt) region-before (Kopfzeile) region-after (Fußzeile) region-start (linke Sidebar) region-end (rechte Sidebar)
  • 8. Der Layout-Master Der Layout-Master beschreibt das Grundlayout für eine Seite. Es können mehrere Master für unterschiedliche Darstellungen in einem Dokument verwendet werden: <fo:layout-master-set> <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" margin-top="1.3cm" margin-bottom="1.8cm" margin-left="1.5cm" margin-right="1.5cm"> <fo:region-body margin-top="4cm" margin-bottom="1cm" /> <fo:region-before extent="6cm" /> <fo:region-after extent="1.8cm" /> </fo:simple-page-master> <fo:simple-page-master master-name="A4-start" page-height="29.7cm" page-width="21cm" margin-top="1.3cm" margin-bottom="2.2cm" margin-left="1.5cm" margin-right="1.5cm" > <fo:region-body margin-top="8cm" margin-bottom="1cm" /> <fo:region-before extent="8cm" />
  • 10. fo:page-sequence <fo:page-sequence master-reference="A4-start"> … </fo:page-sequence> Entspricht dem Element section und markiert einen Abschnitt eines Dokuments, zum Beispiel ein Kapitel. Das Attribute masterreference bezieht sich auf den zu verwendenden Layout-Master.
  • 11. fo:flow <fo:flow flow-name="xsl-region-body"> … </fo:flow> Der Inhalt einer Page werden in fo:flow eingebettet. Passt der Content nicht auf eine Seite wird er automatisch auf der nächsten Seite fortgeführt. Das Attribut flow-name gibt an, in welcher Region der Inhalt angezeigt wird.
  • 12. fo:block <fo:block> Hello, world! </fo:block> <fo:block id="end" /> fo:block entspricht dem div-Container im HTML. Da es keine eigenen Tags für Absätze, Überschriften oder ähnliches gibt, wird über das fo:block-Element der Inhalt definiert und gestyled. fo:block als Inline-Element. Hier ist das Inline-Element mit der id "end" ein Marker, um festzulegen, dass dies die letzte Seite ist.
  • 13. Exkurs: Seitennummern anzeigen <fo:block> <fo:page-number /> / <fo:page-number-citation-last ref-id="end" /> </fo:block>
  • 14. Tabellen Tabellen sind vom Aufbau her den HTML-Tabellen sehr ähnlich. Der Inhalt gliedert sich in die drei Bereich fo:table-body, fo:tableheader und fo:table-footer. Wobei fo:table-header und fo:table-footer immer vor dem fo:table-body definiert werden.
  • 15. Tabellen <fo:table table-layout="fixed" width="12cm"> <fo:table-column column-number="1" column-width="5cm"/> <fo:table-column column-number="2" column-width="3cm"/> <fo:table-column column-number="3" column-width="4cm"/> <fo:table-body> <fo:table-row> <fo:table-cell number-rows-spanned="4"> <fo:block> <fo:external-graphic src="{{ logo }}" content-width="3.5cm" /> </fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block font-weight="bold">{{ senderAddress.firm }}</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell number-columns-spanned="2" padding-bottom="0.1cm"> <fo:block>{{ senderAddress.street }}</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table>
  • 16. Tabellen Das Attribut table-layout bestimmt, ob die Tabelle eine feste Spaltenbreite hat, oder diese sich automatisch an den Inhalt anpasst. Unser derzeitiger Prozessor Apache FOP unterstützt leider nur den Wert fixed, der eine feste Spaltenbreite erzeugt.
  • 17. Prozessoren Mittels Prozessoren wird aus XSL:FO ein gestaltetes Dokument. der Prozessor ist entscheident für die Möglichkeiten in XSL:FO. Apache FOP + kostenlos + wird bei OFCS verwendet – wird nicht weiterentwickelt – nur wenig Unterstützung für Darstellungsoptionen
  • 18. Prozessoren Antenna House Formatter – (ziemlich hohe) Lizenzgebühren + unterstützt CSS + wird weiterentwickelt Ecrion – Lizenzgebühren + viele Ausgabeformate (PDF, PowerPoint, HTML, Word) + wird weiterentwickelt + großflächige Unterstützung von weiteren Technologien (Maps, Charts, SVG)
  • 19. Hübsch machen – geht das? JEIN © 2013 Antonia Ilski
  • 20. Layouts sind nur rudimentär möglich, so wie damals 1999, als Webseiten noch im table-Layout gestaltet wurden. Jedes Element unterstützt verschiedene Gestaltungsattribute, um etwas aufgehübscht zu werden. background-attachment · border-before-color · border-before-style · border-be padding-after · font-family · font-size · font-style · font-weight · margin-t start-indent · relative-position · display-align · … ·