Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and...
-
Upload
charles-hicks -
Category
Documents
-
view
213 -
download
1
Transcript of Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and...
![Page 1: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/1.jpg)
Multimedia Seminar
XSLT
Tobias Naumann
![Page 2: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/2.jpg)
MM Seminar - XSLT 2
Structure
What is XSLT? Design and Concepts Practical use Examples
![Page 3: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/3.jpg)
What is XSLT?
Popularity of XML Alternative Interfaces: Document Object Model (DOM) Simple API for XML Processing (SAX). Require knowledge of these
Languages XSLT as simplification
![Page 4: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/4.jpg)
What is XSLT?
One of 3 parts of XSL XSLT XPath XSL-FO (XSL Formatting Objects)
![Page 5: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/5.jpg)
What is XSLT?
Implemented in XML, XML Syntax Transformation in any output file
format Developed by James Clark (XSLT 1.0,
XSLT 1.1) At the moment version 2.0 (Michael
Kay )
![Page 6: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/6.jpg)
MM Seminar - XSLT 6
Structure
What is XSLT? Design and Concepts Practical use Examples
![Page 7: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/7.jpg)
Design and Concepts
XSLT Program = Stylesheet XSLT Stylesheets using XML syntax Parts of the stylesheet = Templates Templates describe the rules how to
transform a source document into the target format
![Page 8: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/8.jpg)
Design and Concepts
XSLT free of side effects (functional language)
Iteration and Recursion XSLT based on Pattern Matching XSLT and XPath since 1999 (Version
1.0) official standards of the W3C
![Page 9: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/9.jpg)
Design and Concepts
XPath: Referencing parts of XML documents Tree structure Relative und absolute reference to
nodes possible
![Page 10: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/10.jpg)
Design and Concepts
Illustration:
<nodes> <node id="1">N1</node> <node id="2">N2</node> <supernode id="3"> <node id="4">N4</node> </supernode> <node id="5">N5</node></nodes>
![Page 11: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/11.jpg)
Design and Concepts
![Page 12: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/12.jpg)
MM Seminar - XSLT 12
Structure
What is XSLT? Design and Concepts Practical use Examples
![Page 13: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/13.jpg)
Practical use
Webservice for stock exchange in XML One document for different target
platforms Variable designs Exchange of business documents
![Page 14: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/14.jpg)
MM Seminar - XSLT 14
Structure
What is XSLT? Design and Concepts Practical use Examples
![Page 15: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/15.jpg)
Examples
Functioning of XSLT Processors: read an elemente (actual Context) search matching template in stylesheet If none is found, use standard template Process data with rules of template Read next elemente Repeat until no elements left
![Page 16: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/16.jpg)
Examples
„Hallo Welt!“ Beispiel
<?xml version="1.0"?>
<greeting> Hallo Welt!</greeting>
![Page 17: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/17.jpg)
<xsl:stylesheetxmlns:xsl="http://www.w3c.org/1999/XSL/Transform"version="1.0">
<xsl:template match="/"> <html> <head> <title>Hallo Welt!</title> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template>
<xsl:template name="greeting" match="greeting"> <h1>Greeting: <xsl:value-of select="."/></h1> </xsl:template>
</xsl:stylesheet>
![Page 18: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/18.jpg)
Examples
output:<html> <head> <title>Hallo Welt!</title> </head> <body> <h1> Greeting: Hallo Welt! </h1> </body></html>
![Page 19: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/19.jpg)
Examples
<xsl:if>
<xsl:if test="count(titel) > 0"> <xsl:value-of select="titel"/></xsl:if>
![Page 20: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/20.jpg)
Examples
<xsl:choose>, <xsl:when> and <xsl:otherwise>
<xsl:choose> <xsl:when test="count(titel) > 0"> <xsl:value-of select="titel"/> </xsl:when> <xsl:otherwise> (Kein Titel) </xsl:otherwise></xsl:choose>
![Page 21: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/21.jpg)
Examples
Iteration with <xsl:for-each>
<xsl:for-each select="adressen/adresse"> <xsl:sort select="vorname"/> <xsl:call-template name="template2"/></xsl:for-each>
![Page 22: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/22.jpg)
Examples
<xsl:param> and <xsl:variable>
<xsl:param name="x„ select=„5“/>
<xsl:template match="/"> <xsl:variable name="y" select="$x+1"/> x = <xsl:value-of select="$x"/><br/> y = <xsl:value-of select="$y"/><br/></xsl:template>
![Page 23: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/23.jpg)
XSLT Processors
Xalan, Apache Project Saxon, Java XSL Prozessor XT, by James Clark Sablotron, XML and XSLT Toolkit Oracle Micrososft XSLT Tools
![Page 24: Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.](https://reader036.fdocuments.us/reader036/viewer/2022070306/55160f62550346a2308b5235/html5/thumbnails/24.jpg)
End… Questions?
??
?
?
??