Dynamische Inhalte und Formate p. 1/3 Dynamische Inhalte und Formate Seminar Document Engineering Dennis Busch dennis.busch@gmx.de Institut für Softwaretechnologie Fakultät für Informatik Universität der Bundeswehr München
Dynamische Inhalte und Formate p. 2/3 XML in 10 Points 3. XML is text, but isn t meant to be read http://www.w3.org/xml/1999/xml-in-10-points
Dynamische Inhalte und Formate p. 3/3 Gliederung 1. Problemstellung 2. XSL (a) XSLT (b) XPath (c) XSL-FO (d) CSS als Alternative? 3. L A T E X 4. Joining Together
Dynamische Inhalte und Formate p. 4/3 Problemstellung XML ist nicht dafür gedacht, von Menschen gelesen zu werden
Dynamische Inhalte und Formate p. 4/3 Problemstellung XML ist nicht dafür gedacht, von Menschen gelesen zu werden XML bildet lediglich Struktur der Daten ab
XML im Browser Dynamische Inhalte und Formate p. 5/3
Dynamische Inhalte und Formate p. 6/3 Lösung Hinzufügen von Layoutinformation oder
Dynamische Inhalte und Formate p. 6/3 Lösung Hinzufügen von Layoutinformation oder Transformation in darstellbare Formate
Dynamische Inhalte und Formate p. 7/3 XSL Die Extensible Stylesheet Language (XSL) ist eine W3C Spezifikation um Transformationen von XML-Sprachen zu definieren.
Dynamische Inhalte und Formate p. 7/3 XSL Die Extensible Stylesheet Language (XSL) ist eine W3C Spezifikation um Transformationen von XML-Sprachen zu definieren. XSL besteht aus drei Sprachen:
Dynamische Inhalte und Formate p. 7/3 XSL Die Extensible Stylesheet Language (XSL) ist eine W3C Spezifikation um Transformationen von XML-Sprachen zu definieren. XSL besteht aus drei Sprachen: XSL Transformations (XSLT) XML Path Language (XPath) XSL Formatting Objects (XSL-FO)
Dynamische Inhalte und Formate p. 8/3 XSLT XSLT beschreibt Transformationen von XML Dokumenten in andere Formate, z.b.:
Dynamische Inhalte und Formate p. 8/3 XSLT XSLT beschreibt Transformationen von XML Dokumenten in andere Formate, z.b.: HTML
Dynamische Inhalte und Formate p. 8/3 XSLT XSLT beschreibt Transformationen von XML Dokumenten in andere Formate, z.b.: HTML Plain Text
Dynamische Inhalte und Formate p. 8/3 XSLT XSLT beschreibt Transformationen von XML Dokumenten in andere Formate, z.b.: HTML Plain Text L A T E X
Dynamische Inhalte und Formate p. 8/3 XSLT XSLT beschreibt Transformationen von XML Dokumenten in andere Formate, z.b.: HTML Plain Text L A T E X SVG
XSLT Verarbeitung Dynamische Inhalte und Formate p. 9/3
Dynamische Inhalte und Formate p. 10/3 XML Baumstruktur Quelle: http://www.fujitsu.com/img/xml/tech/pictxpath1.gif
Dynamische Inhalte und Formate p. 11/3 XSLT Baumtransformation Quelle: http://www.w3.org/tr/2001/rec-xsl-20011015/tree1-2.gif
Dynamische Inhalte und Formate p. 12/3 Aufbau von Stylesheets XSLT Stylesheets bestehen aus drei Arten von Befehlen:
Dynamische Inhalte und Formate p. 12/3 Aufbau von Stylesheets XSLT Stylesheets bestehen aus drei Arten von Befehlen: Root-Elemente: Wurzel des Dokumentenbaums
Dynamische Inhalte und Formate p. 12/3 Aufbau von Stylesheets XSLT Stylesheets bestehen aus drei Arten von Befehlen: Root-Elemente: Wurzel des Dokumentenbaums Toplevel-Elemente: erzeugen z.b. Vorlagen oder Funktionsdeklarationen
Dynamische Inhalte und Formate p. 12/3 Aufbau von Stylesheets XSLT Stylesheets bestehen aus drei Arten von Befehlen: Root-Elemente: Wurzel des Dokumentenbaums Toplevel-Elemente: erzeugen z.b. Vorlagen oder Funktionsdeklarationen Instruktionen sind Befehle wie Anwedung von Vorlagen, Bedingungen oder Schleifen
Dynamische Inhalte und Formate p. 13/3 XSLT Beispiel: example.xml <?xml version="1.0"?> <shout>xsl is great!</shout>
Dynamische Inhalte und Formate p. 14/3 XSLT Beispiel: example.xsl <?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3c.org/1999/xsl/(...)"> <xsl:template match="/"> <html> <body> <h1>let s shout:</h1> <p><xsl:value-of select="shout"/></p> </body> </html> </xsl:template> </xsl:stylesheet>
Dynamische Inhalte und Formate p. 15/3 XSLT Beispiel: example.html <html> <body> <h1>let s shout:</h1> <p>xsl is great!</p> </body> </html>
Dynamische Inhalte und Formate p. 16/3 XPath Die XML Path Language (XPath) ist eine Abfrage-Sprache, um Teile eines XML-Dokumentes zu adressieren.
Dynamische Inhalte und Formate p. 16/3 XPath Die XML Path Language (XPath) ist eine Abfrage-Sprache, um Teile eines XML-Dokumentes zu adressieren. XPath bildet in der Version 2.0 eine Teilmenge und die Grundlage der XML Query Language (XQuery).
Dynamische Inhalte und Formate p. 16/3 XPath Die XML Path Language (XPath) ist eine Abfrage-Sprache, um Teile eines XML-Dokumentes zu adressieren. XPath bildet in der Version 2.0 eine Teilmenge und die Grundlage der XML Query Language (XQuery). Grundlage für die Adressierung: Darstellung des XML-Dokuments als Baum.
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden Location Steps bestehen aus:
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden Location Steps bestehen aus: Achsenbezeichner
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden Location Steps bestehen aus: Achsenbezeichner Knotentest
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden Location Steps bestehen aus: Achsenbezeichner Knotentest Prädikat (optional)
Dynamische Inhalte und Formate p. 17/3 XPath Syntax URI-ähnliche Syntax Pfad besteht aus einem oder mehreren Location Steps, die durch / getrennt werden Location Steps bestehen aus: Achsenbezeichner Knotentest Prädikat (optional) achsenbezeichner::knotentest()[prädikat]
Dynamische Inhalte und Formate p. 18/3 XPath Achsen Tabelle 1: Example XPath Axis Specifiers specifier selected nodes self child descendant parent anchestor attribute the current node children of the current node all descendants of the current node parents of the current node all ancestors of the current node attribute nodes
/child::node()/child::contact[attribute::no= 2 ] Dynamische Inhalte und Formate p. 19/3 XPath Beispiel /descendant::contact[string="jiro Kawasaki"] /following-sibling::note
Dynamische Inhalte und Formate p. 20/3 XPath Abkürzungen Tabelle 2: Common XPath Shortcuts expression shortcut child::test self::node(). parent::node().. descendant-or-self::node() // attribute:: test @
Dynamische Inhalte und Formate p. 21/3 XSL-FO XSL Formatting Objects (XSL-FO) ist eine XML-Sprache, mit der XML-Dokumente für die Druckausgabe auf Papier oder Monitor formatiert werden können.
Quelle: http://www.w3.org/tr/2001/rec-xsl-20011015/two-process.gif Dynamische Inhalte und Formate p. 21/3 XSL-FO XSL Formatting Objects (XSL-FO) ist eine XML-Sprache, mit der XML-Dokumente für die Druckausgabe auf Papier oder Monitor formatiert werden können.
XSL-FO Beispiel <?xml version="1.0"> <fo:root xmlns:fo="http://www.w3c.org/1999/xsl/f <fo:layout-master-set> <fo:simple-page-master master-name="only"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="only"> <fo:flow flow-name="xsl-region-body"> <fo:block>xsl-fo is great!</block> </fo:flow> </fo:page-sequence> </fo:root> Dynamische Inhalte und Formate p. 22/3
Dynamische Inhalte und Formate p. 23/3 CSS Cascading Stylesheets (CSS) ist keine XML-Sprache, aber definiert Formatanweisungen für HTML- oder XML-Dokumente.
Dynamische Inhalte und Formate p. 23/3 CSS Cascading Stylesheets (CSS) ist keine XML-Sprache, aber definiert Formatanweisungen für HTML- oder XML-Dokumente. Die Dokumente werden nicht transformiert, den Elementen werden bestimmte Eigenschaften zugewiesen.
Dynamische Inhalte und Formate p. 24/3 CSS XSL uses a XML notation, CSS uses its own. In CSS, the formatting object tree is almost the same as the source tree, and inheritance of formatting properties is on the source tree. In XSL, the formatting object tree can be radically different from the source tree, and inheritance of formatting properties is on the formatting object tree. Quelle: Kreulich 2003
Dynamische Inhalte und Formate p. 25/3 CSS Beispiel shout { font-style: bold; color: red; background-color: white; } Einbinden in ein XML-Dokument: <?xml-stylesheet href="example.css" type="text/css"?>
CSS - Alternative zu XSL? Dynamische Inhalte und Formate p. 26/3
Dynamische Inhalte und Formate p. 26/3 CSS - Alternative zu XSL? CSS ist keine Alternative zu XSL - die beiden Konzepte ergänzen sich!
Dynamische Inhalte und Formate p. 26/3 CSS - Alternative zu XSL? CSS ist keine Alternative zu XSL - die beiden Konzepte ergänzen sich! CSS kann Dokumente nicht neu anordnen
Dynamische Inhalte und Formate p. 26/3 CSS - Alternative zu XSL? CSS ist keine Alternative zu XSL - die beiden Konzepte ergänzen sich! CSS kann Dokumente nicht neu anordnen CSS kann Dokumente für die Darstellung im Browser anpassen, aber nicht für den Druck
Dynamische Inhalte und Formate p. 26/3 CSS - Alternative zu XSL? CSS ist keine Alternative zu XSL - die beiden Konzepte ergänzen sich! CSS kann Dokumente nicht neu anordnen CSS kann Dokumente für die Darstellung im Browser anpassen, aber nicht für den Druck Aber: CSS macht das Design von Webseiten einfacher durch Trennung von Designvorlagen und Design
Dynamische Inhalte und Formate p. 27/3 L A TEX L A T E X ist ein Makropaket für das Textsatzsystem T E X.
Dynamische Inhalte und Formate p. 27/3 L A TEX L A T E X ist ein Makropaket für das Textsatzsystem T E X. It offers programmable desktop publishing features and extensive facilities for automating most aspects of typesetting and desktop publishing, including numbering and cross-referencing, tables and figures, page layout, bibliographies, and much more. L A T E X was originally written in 1984 by Leslie Lamport and has become the dominant method for using TeX; few people write in plain TeX any more. (from Wikipedia, the free encyclopedia)
Dynamische Inhalte und Formate p. 28/3 L A TEX Syntax L A T E X ist eine Markupsprache wie XML, ist allerdings ausschließlich zum Textsatz geeignet. \overlays{2}{ \begin{slide}{problemstellung} \begin{itemstep} \item XML ist nicht dafür gedacht, von Menschen geles \item XML bildet lediglich Struktur der Daten ab \end{itemstep} \end{slide} }
Dynamische Inhalte und Formate p. 29/3 Joining Together Alle gezeigten Konzepte haben einen speziellen Einsatzbereich.
Dynamische Inhalte und Formate p. 29/3 Joining Together Alle gezeigten Konzepte haben einen speziellen Einsatzbereich. Durch Kombination erhält man effiziente Systeme um Dokumente
Dynamische Inhalte und Formate p. 29/3 Joining Together Alle gezeigten Konzepte haben einen speziellen Einsatzbereich. Durch Kombination erhält man effiziente Systeme um Dokumente zu erstellen
Dynamische Inhalte und Formate p. 29/3 Joining Together Alle gezeigten Konzepte haben einen speziellen Einsatzbereich. Durch Kombination erhält man effiziente Systeme um Dokumente zu erstellen in verschiedensten Formaten zu nutzen
Dynamische Inhalte und Formate p. 29/3 Joining Together Alle gezeigten Konzepte haben einen speziellen Einsatzbereich. Durch Kombination erhält man effiziente Systeme um Dokumente zu erstellen in verschiedensten Formaten zu nutzen zu archivieren
Dynamische Inhalte und Formate p. 30/3 Beispiel - Webportal (1) Dokumente sollen nur im Browser angezeigt werden
Dynamische Inhalte und Formate p. 30/3 Beispiel - Webportal (1) Dokumente sollen nur im Browser angezeigt werden Klassischer Ansatz: statisches HTML
Dynamische Inhalte und Formate p. 30/3 Beispiel - Webportal (1) Dokumente sollen nur im Browser angezeigt werden Klassischer Ansatz: statisches HTML Problem: Änderung des Corporate Design erfordert schlimmstenfalls Änderung aller Dateien
Dynamische Inhalte und Formate p. 30/3 Beispiel - Webportal (1) Dokumente sollen nur im Browser angezeigt werden Klassischer Ansatz: statisches HTML Problem: Änderung des Corporate Design erfordert schlimmstenfalls Änderung aller Dateien Lösung: Designvorlagen mit CSS nutzen
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können Klassischer Ansatz: Dokumente in mehreren Formaten vorrätig halten
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können Klassischer Ansatz: Dokumente in mehreren Formaten vorrätig halten Problem: Redundanzen
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können Klassischer Ansatz: Dokumente in mehreren Formaten vorrätig halten Problem: Redundanzen Lösung: Dokumente XML-basiert
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können Klassischer Ansatz: Dokumente in mehreren Formaten vorrätig halten Problem: Redundanzen Lösung: Dokumente XML-basiert XSLT zur Transformierung in gewünschtes Zielformat on demand
Dynamische Inhalte und Formate p. 31/3 Beispiel - Webportal (2) Dokumente sollen ausgedruckt oder im Browser angeschaut werden können Klassischer Ansatz: Dokumente in mehreren Formaten vorrätig halten Problem: Redundanzen Lösung: Dokumente XML-basiert XSLT zur Transformierung in gewünschtes Zielformat on demand CSS regelt weiter das Layout von erzeugten HTML-Dateien
Dynamische Inhalte und Formate p. 32/3 Beispiel - Webportal (3) Dokumente sollen nach der Nutzung Archiviert werden
Dynamische Inhalte und Formate p. 32/3 Beispiel - Webportal (3) Dokumente sollen nach der Nutzung Archiviert werden Klassischer Ansatz: Dokumente im vorhandenen Format abspeichern
Dynamische Inhalte und Formate p. 32/3 Beispiel - Webportal (3) Dokumente sollen nach der Nutzung Archiviert werden Klassischer Ansatz: Dokumente im vorhandenen Format abspeichern Problem: Migration/Emulation
Dynamische Inhalte und Formate p. 32/3 Beispiel - Webportal (3) Dokumente sollen nach der Nutzung Archiviert werden Klassischer Ansatz: Dokumente im vorhandenen Format abspeichern Problem: Migration/Emulation Lösung: Archivierung der XML-Dokumente, Stylesheets etc.
Dynamische Inhalte und Formate p. 32/3 Beispiel - Webportal (3) Dokumente sollen nach der Nutzung Archiviert werden Klassischer Ansatz: Dokumente im vorhandenen Format abspeichern Problem: Migration/Emulation Lösung: Archivierung der XML-Dokumente, Stylesheets etc. Automatisierte Migration möglich (solange XML verstanden wird)
Dynamische Inhalte und Formate p. 33/3 Danke für s Zuhören! Fragen?