<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../app/xmlpres.xsl"?>
<presentation>
    <options>
        <stylesheet>westhoff_schlitt.css</stylesheet> 
    </options>
    <general>
        <title>Validate and Transform XML</title>
        <title>using XML-Schema and XML-Stylesheets</title>
        <author>Jakob Westhoff (jakob@php.net)</author>
        <author>Tobias Schlitt (toby@php.net)</author>
        <date>Tue, 2007-04-17</date>
        <location>University of Dortmund</location>
    </general>
    <slides>
        <slide title="Agenda">
            <ul>
                <li>About us</li>
				<li>What's all about this XSD?</li>
				<li>A simple example</li>
				<li>Simple types</li>
				<li>Complex types</li>
				<li>Predefined data types</li>

				<!-- Toby: -->
				<li>What's all about this XSL?</li>
				<li>What can I do with XSLT?</li>
				<li>What is XPath?</li>
				<li>XPath terminologie</li>
				<li>XPath syntax</li>
				<li>Starting over with XSLT</li>
				<li>The basic structure</li>
				<li><![CDATA[<xsl:template>]]></li>
				<li><![CDATA[<xsl:value-of> and <xsl:apply-templates>]]></li>
				<li><![CDATA[<xsl:for-each> and <xsl:element>]]></li>
				<li>The result</li>
				<li>Conclusion</li>
            </ul>
        </slide>
        <slide title="About Us">
			<p>Jakob Westhoff</p>
			<p>Contact: jakob@php.net</p>
			<ul>
				<li>PHP Developer for more than 5 years</li>
				<li>Currently studying information science at the university of Dortmund</li>
				<li>Founder of the PHP-Usergroup-Dortmund</li>
				<li>Freelancing Software Architect and Author</li>
			</ul>
        </slide>
        <slide title="About Us">
			<p>Tobias Schlitt</p>
			<p>Contact: toby@php.net</p>
			<ul>
				<li>PHP Developer for more than 6 years</li>
				<li>Company trained IT Specialist (Deutsche Bank)</li>
				<li>Working for eZ Systems on the eZ Components project</li>
				<li>Member of Zend PHP Certification Board</li>
				<li>Freelancing Software Architect, Author, Trainer</li>
			</ul>
        </slide>
		<slide title="What's all about this XSD?">
			<ul>
				<li>XSD = XML Schema Definition</li>
				<li>Define the legal building blocks of an XML document
					<ul>
                        <li>Elements</li>
                        <li>Attributes</li>
                        <li>Order/number of child elements</li>
                        <li>Allowed data types</li>
                        <li>...</li>
					</ul>
				</li>
				<li>Easily validate a given XML file to a schema</li>
				<li>W3C Recommendation since 02. May 2001</li>
				<li>Successors of DTD</li>
			</ul>
		</slide>
		<slide title="A simple example">
            <p>A simple XML document</p>
			<code type="xml"><![CDATA[
<message>
    <from>Jakob Westhoff</from>
    <to>Tobias Schlitt</to>
    <topic>XSD is the successor of DTD</topic>
    <body>
        Hi Toby!
        XSD is definetly more advanced than the somehow
        outdated document type definitions
    </body>
</message>
			]]></code>
            <p>An appropriate XSD file</p>
            <code type="xml"><![CDATA[
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="message">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="from"  type="xs:string" />
                <xs:element name="to"    type="xs:string" />
                <xs:element name="topic" type="xs:string" />
                <xs:element name="body"  type="xs:string" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
            ]]></code>
            <p>Asscoiate the xsd with the document</p>
            <code type="xml"><![CDATA[
<message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="message.xsd">

 ...

</message>
            ]]></code>
		</slide>
        <slide title="Simple Types">
            <ul>
                <li>Simple type elements have certain limitations
                    <ul>
                        <li>Only character data allowed</li>
                        <li>No child elements are allowed</li>
                    </ul>                
                </li>
                <li>Some useful predefined types
                    <ul>
                        <li>xs:string</li>
                        <li>xs:integer</li>
                        <li>xs:decimal</li>
                        <li>xs:boolean</li>
                        <li>xs:date</li>
                        <li>...</li>
                    </ul>
                </li>
            </ul>
            <code type="xml"><![CDATA[
<xs:element name="foobar" type="xs:string" default="nothing specified" />
<xs:element name="baz"    type="xs:boolean" />
            ]]></code>
            <code type="xml"><![CDATA[
<foobar>Any string content</foobar>
<baz>true|false</baz>
            ]]></code>
        </slide>
        <slide title="Simple Types">
            <ul>
                <li>Restrictions
                    <ul>
                        <li>Are applied to already known predefined types</li>
                        <li>e.g. Limit the range of an integer or restrict integers to an enumeration</li>
                    </ul>
                </li>
            </ul>
            <p>Limit integer range</p>
            <code type="xml"><![CDATA[
<xs:element name="age">
    <xs:simpleType>
        <xs:restrictions base="xs:integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="100"/>
        </xs:restrictions>
    </xs:simpleType>
</xs:element>                
            ]]></code>
            <p>Restrict strings with enumerations</p>
            <code type="xml"><![CDATA[
<xs:element name="university">
    <xs:simpleType>
        <xs:restrictions base="xs:string">
            <xs:enumeration value="Dortmund"/>
            <xs:enumeration value="Bochum"/>
            <xs:enumeration value="Duesseldorf"/>
        </xs:restrictions>
    </xs:simpleType>
</xs:element>                
            ]]></code>
            <p>Regular expression pattern matching</p>
            <code type="xml"><![CDATA[
<xs:element name="word">
    <xs:simpleType>
        <xs:restrictions base="xs:string">
            <xs:pattern value="[a-zA-Z]*" />
        </xs:restrictions>
    </xs:simpleType>
</xs:element>                
            ]]></code>
        </slide>
        <slide title="Complex Types">
            <ul>
                <li>Complex types may contain
                    <ul>
                        <li>Nothing</li>
                        <li>Character data</li>
                        <li>Other elements</li>
                        <li>Both</li>
                        <li>Attributes</li>
                    </ul>
                </li>
            </ul>
            <p>Complex type example</p>
            <code type="xml"><![CDATA[
<person group="friends">
    <firstname>Tobias</firstname>
    <lastname>Schlitt</lastname>
    <age>26</age>
    <note>fellow student</note>
    <note>good friend of mine</note>
</person>               
            ]]></code>
            <code type="xml"><![CDATA[
<xs:element name="person">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="firstname" type="xs:string" />
            <xs:element name="lastname" type="xs:string" />
            <xs:element name="age" type="xs:integer" />
            <xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="group" type="xs:string" use="required" />
    </xs:complexType>
</xs:element>
            ]]></code>
            <p>Split type and element definition</p>
            <code type="xml"><![CDATA[
<xs:element name="person" type="personType" />

<xs:complexType name="personType">
    <xs:sequence>
        <xs:element name="firstname" type="xs:string" />
        <xs:element name="lastname" type="xs:string" />
        <xs:element name="age" type="xs:integer" />
        <xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="group" type="xs:string" use="required" />
</xs:complexType>
            ]]></code>
            <p>Adding attributes to predefined simple types</p>
            <code type="xml"><![CDATA[
<xs:element name="person">
    <xs:complexType>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="group" type="xs:string" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
</xs:element>
            ]]></code>
            <p>Mix character data with elements</p>
            <code type="xml"><![CDATA[
<message>
    You are a <b>great</b> audience
</message>            
            ]]></code>
            <code type="xml"><![CDATA[
<xs:element name="message">
    <xs:complexType mixed="true">
        <xs:sequence>
            <xs:element name="b" type="xs:string" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
</xs:element>            
            ]]></code>  
        </slide>
        <slide title="Complex Types">
            <ul>
                <li>Indicators
                    <ul>
                        <li>Order indicators</li>
                        <li>Occurance indicators</li>
                        <li>Group indicators</li>
                    </ul>
                </li>
            </ul>            
        </slide>
        <slide title="Order Indicators">
            <ul>
                <li>Order Indicators
                    <ul>
                        <li>Sequence
                            <ul>
                                <li>Child elements need specific order</li>
                            </ul>
                        </li>
                        <li>Choice
                            <ul>
                                <li>Only one of the specified elements is needed</li>                                
                            </ul>
                        </li>
                        <li>All
                            <ul>
                                <li>All of the elements are needed</li>
                                <li>Order not specified</li>
                                <li>min and maxOccurs may only be 1 or 0</li>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>            
            <code type="xml"><![CDATA[
<xs:element name="person">
    <xs:complexType>
        <xs:choice>

            ...

        </xs:choice>        
    </xs:complexType>
</xs:element>
            ]]></code>
            <code type="xml"><![CDATA[
<xs:all>
    
    ...

</xs:all>                
            ]]></code>
        </slide>
        <slide title="Occurance Indicators">
            <ul>
                <li>Occurance Indicators
                    <ul>
                        <li>Already known</li>
                        <li>minOccurs</li>
                        <li>maxOccurs</li>                        
                    </ul>
                </li>
            </ul>
            <p>Occurance indicators may be applied to order indicators</p>
            <code type="xml"><![CDATA[
<drinks>
    <nonalcoholic>coffee</nonalcoholic>
    <alcoholic>beer</alcoholic>
    <nonalcoholic>limonade</nonalcoholic>
</drinks>
            ]]></code>
            <code type="xml"><![CDATA[
<xs:element name="drinks">
    <xs:complexType>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="alcoholic" type="xs:string" />
            <xs:element name="nonalcoholic" type="xs:string" />            
        </xs:choice>
    </xs:complexType>
</xs:element>                
            ]]></code>
        </slide>
        <slide title="Group Indicators">
            <ul>
                <li>Used to define related elements</li>
                <li>Can be referenced inside the xsd multiple times</li>
                <li>Work for element and attribute definitions</li>                
            </ul>
            <p>Something you already know</p>
            <code type="xml"><![CDATA[
<xs:element name="drinks">
    <xs:complexType>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="alcoholic" type="xs:string" />
            <xs:element name="nonalcoholic" type="xs:string" />            
        </xs:choice>
    </xs:complexType>
</xs:element>                
            ]]></code>
            <p>Can also be defined as a group</p>
            <code type="xml"><![CDATA[
<xs:group name="drinkgroup">
    <xs:choice>
        <xs:element name="alcoholic" type="xs:string" />
        <xs:element name="nonalcoholic" type="xs:string" />            
    </xs:choice>
</xs:group>
            ]]></code>
            <p>Now it can be referenced any where in the schema</p>
            <code type="xml"><![CDATA[
<xs:element name="drinks">
    <xs:complexType>
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="drinkgroup" />
        </xs:choice>
    </xs:complexType>
</xs:element>                
            ]]></code>
        </slide>
        <slide title="Group Indicators">
            <p>Attribute group example</p>
            <code type="xml"><![CDATA[
<drinks>
    <drink type="alcoholic" rating="5" name="beer" />
    <drink type="nonalcoholic" rating="7" name="coffee" />
</drinks>                
            ]]></code>
            <code type="xml"><![CDATA[
<xs:attributeGroup name="drinkattributegroup">
    <xs:attribute name="type" type="xs:string" use="required">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="alcoholic" />
                <xs:enumeration value="nonalcoholic" />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="rating" type="xs:integer" />
    <xs:attribute name="name" type="xs:string" />
</xs:attributeGroup>            
            ]]></code>
            <code type="xml"><![CDATA[
<xs:element name="drinks">
    <xs:complexType>
        <xs:attributeGroup ref="drinkattributegroup" />
    </xs:complexType>
</xs:element>                
            ]]></code>
        </slide>
		<slide title="What's all about this XSL?">
			<p>XSL = e<strong>X</strong>tensible <strong>S</strong>tylesheet <strong>L</strong>anguage.</p>
			<ul>
				<li>W3C recommendation since October 2001</li>
				<li>XSL consists of:
					<ul>
						<li><strong>XSLT</strong> = <strong>XSL</strong> <strong>T</strong>ransformations</li>
						<li><strong>XSL-FO</strong> = <strong>XSL</strong> <strong>F</strong>ormatting <strong>O</strong>bjects</li>
						<li><strong>XPath</strong> = Navigation and selection language for XML elements</li>
					</ul>
				</li>
				<li>When saying <strong>XSL</strong> most people mean <strong>XSLT</strong>.</li>
			</ul>
		</slide>
		<slide title="So, what's all about this XSLT then?">
			<p><strong>XSLT</strong> = e<strong>X</strong>tensible <strong>S</strong>tylesheet <strong>L</strong>anguage <strong>T</strong>ransformations.</p>
			<ul>
				<li>W3C recommendation since November 16th 1999</li>
				<li>Current version is 2.0 (since 2007-01-23)</li>
				<li>XML based</li>
				<li>Declarative, funktional-applicative programming language</li>
				<li>Used for transformations between XML formats</li>
				<li>Originally defined to transform any XML into XSL-FO</li>
				<li>Makes use of XPath</li>
				<li>Commonly used to transform between any XML formats</li>
				<li>All modern browsers support XSLT (more or less)</li>
				<li>Little known fact: XSLT is turing complete</li>
			</ul>
			<p>Attention: Recursion is everything in a functional language!</p>
		</slide>
		<slide title="What can I do with XSLT?">
			<ul>
				<li>XML formats are descriptive</li>
				<li>When defining a format, ignore everything but the pure meaning of data!</li>
				<li>To allow others to work with your data: Transform it into their language!</li>
				<li>Example: Transforming a data storage format into XHTML to view it in a browser</li>
			</ul>
			<p>Some simple XML document:</p>
			<code type="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<document>
    <title>Simple test document</title>
    <paragraph>
        This is the first paragraph.
    </paragraph>
    <paragraph>
        This is the second paragraph.
    </paragraph>
</document>
			]]></code>
			<p>A stylesheet to transform this document into XHTML:</p>
			<code type="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="html"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        indent="yes" />

    <xsl:template match="document">
        <html>
            <head>
                <title><xsl:value-of select="title" /></title>
            </head>
            <body>
                <xsl:for-each select="paragraph">
                    <p>
                        <xsl:value-of select="." />
                    </p>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
			]]></code>
			<p>The result:</p>
			<code type="xml"><![CDATA[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Simple test document</title>
	</head>
	<body>
		<p>
			This is the first paragraph.
		</p>
		<p>     
			This is the second paragraph.
		</p>
	</body>
</html>
			]]></code>
		</slide>
		<slide title="What is XPath?">
			<p>Before you can learn XSLT, you should know XPath.</p>
			<ul>
				<li>Language to address and select XML elements</li>
				<li>W3C recommendation since November 1999</li>
				<li>Current version is 2.0 (since 2007-01-23)</li>
				<li>Used for navigation in XML structures</li>
				<li>Enables you to select information from an XML document</li>
			</ul>
			<p>You will see many XPath expressions during this session and I will explain them in place!</p>
		</slide>
		<slide title="XPath terminologie">
			<p>In XPath (almost) everything is a <strong>node</strong>.</p>
			<ul>
				<li>
					The root node of an XML document is referred to as the <strong>document node</strong>.
					<code type="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<presentation>
<!-- ... XML structure here... -->
</presentation>
					]]></code>
				</li>
				<li>
					Any tag inside the <strong>document node</strong> is referred to as an <strong>element node</strong>
					<code type="xml"><![CDATA[
<p>This is a paragraph</p>
					]]></code>
				</li>
				<li>
					Attributes of an <strong>element node</strong> are referred to as <strong>attribute nodes</strong>
					<code type="xml"><![CDATA[
<img src="path/to/image.jpg" />
					]]></code>
				</li>
				<li>Everything that is not a node is called an <strong>atomic value</strong></li>
			</ul>
			<p>Every XPath expression matches a <strong>set of nodes</strong> (0..n).</p>
			<p>XML is a tree structure, the usual terms apply:</p>
			<ul>
				<li>Parent</li>
				<li>Child / children</li>
				<li>Sibling</li>
				<li>Ancestor</li>
				<li>Descendant</li>
			</ul>
		</slide>
		<slide title="XPath syntax">
			<p>The XPath syntax is quite simple, but very powerfull.</p>
			<ul>
				<li>Works similar to path references in the file system (Unix syntax)</li>
				<li>Allows traversal on the whole XML tree</li>
				<li>
					Additionally supports more than 100 special functions for:
					<ul>
						<li>string manipulation</li>
						<li>math calculations</li>
						<li>date and time comparison</li>
						<li>node and sequence manipulation</li>
						<li>...</li>
					</ul>
				</li>
			</ul>
			<p>Some basic examples (here for XHTML):</p>
			<ul>
				<li>
					Tag matches:
					<ul>
						<li>Relative match: <strong>ul/li</strong></li>
						<li>Absolute match: <strong>/html/body/p</strong></li>
						<li>Global match: <strong>//img</strong></li>
						<li>Anywhere match: <strong>/html/body/p//img</strong></li>
						<li>Alternative match: <strong>ul|ol</strong></li>
					</ul>
				</li>
				<li>
					Attribute matches:
					<ul>
						<li>Existence match: <strong>//img[@border]</strong></li>
						<li>Value match: <strong>//img[@border='1']</strong></li>
						
					</ul>
				</li>
				<li>
					Relation matches:
					<ul>
						<li>Current node match: <strong>//p/img/.</strong></li>
						<li>Parent node match: <strong>//p/img/..</strong></li>
						<li>Position match: <strong>//ul/li[1]</strong></li>
					</ul>
				</li>
			</ul>
		</slide>
		<slide title="Starting over with XSLT">
			<p>To learn XSLT, we will examine this presentation system <strong>xmlpress</strong>.</p>
			<p>The basic XML structure looks like this:</p>
			<code type="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../app/xmlpres.xsl"?>
<presentation>
    <options>
        <stylesheet>default.css</stylesheet> 
    </options>
    <general>
        <title>Validate and Transform XML</title>
        <title>using XML-Schema and XML-Stylesheets</title>
        <author>Jakob Westhoff (jakob@php.net)</author>
        <author>Tobias Schlitt (toby@php.net)</author>
        <date>Tue, 2007-04-17</date>
        <location>University of Dortmund</location>
    </general>
    <slides>
		<!-- ... more slide elements -->
		<slide title="What is XPath?">
			<p>Before you can learn XSLT, you should know XPath.</p>
			<ul>
				<li>Language to address and select XML elements</li>
				<li>W3C recommendation since November 1999</li>
				<li>Current version is 2.0 (since 2007-01-23)</li>
				<li>Used for navigation in XML structures</li>
				<li>Enables you to select information from an XML document</li>
			</ul>
			<p>You will see many XPath expressions during this session and I will explain them in place!</p>
		</slide>
		<!-- ... more slide elements -->
	</slides>
</presentation>				
			]]></code>
			<p>In following we will build the XSLT to transform this into XHTML, step by step.</p>
		</slide>
		<slide title="The basic structure">
			<p>What every XSLT stylesheet needs:</p>
			<ul>
				<li>XML declaration</li>
				<li>The XSL namespace declaration</li>
				<li>The document root node <![CDATA[<xsl:stylesheet>]]></li>
				<li>At least 1 <![CDATA[<xsl:template>]]> node</li>
			</ul>
			<p>Optionally:</p>
			<ul>
				<li>A defined output method (meta info for the processor)</li>
				<li>More template definitions</li>
			</ul>
			<code type="xml"><![CDATA[
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="html"
		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
		indent="yes" />

    <xsl:template match="presentation">
        <html>
			<!-- HTML code goes here... -->
        </html>
    </xsl:template>

	<!-- More XSLT templates go here -->

</xsl:stylesheet>				
			]]></code>
		</slide>
		<slide title="&lt;xsl:template&gt;">
			<p><![CDATA[<xsl:template>]]></p>
			<ul>
				<li>A template applies to a set of nodes</li>
				<li>The node set is defined by the <strong>match</strong> attribute</li>
				<li>The <strong>match</strong> attribute is an XPath expression</li>
				<li>The selected node set is submitted to the template</li>
			</ul>
			<p>xmlpress uses the following templates:</p>
			<ul>
				<li>
					Process the root node <![CDATA[<presentation>]]>:
					<code type="xml"><![CDATA[
<xsl:template match="presentation">
</xsl:template>
					]]></code>
				</li>
				<li>
					Process the global options:
					<code type="xml"><![CDATA[
<xsl:template match="options/stylesheet">
</xsl:template>
					]]></code>
				</li>
				<li>
					Process misc formatting tags:
					<code type="xml"><![CDATA[
<xsl:template match="ul|li|p|center">
</xsl:template>
					]]></code>
   				</li>
				<li>
					Special processing form image tags:
					<code type="xml"><![CDATA[
<xsl:template match="image">
</xsl:template>
					]]></code>
				</li>
			</ul>
			<p>... there are some more, but those look very similar...</p>
		</slide>
		<slide title="&lt;xsl:value-of&gt; and &lt;xsl:apply-templates&gt;">
			<p><![CDATA[<xsl:value-of>]]></p>
			<ul>
				<li>Prints the value of a selected node</li>
				<li>Attribute "select" defines, what to print using XPath</li>
				<li>XPath expression is local to the current template match</li>
			</ul>
			<p><![CDATA[<xsl:apply-templates>]]></p>
			<ul>
				<li>Indicates to perform apply the given template name</li>
				<li>Applies template to nodes selected by "match" attribute</li>
				<li>Result is inserted at this place (remember: recursion!)</li>
			</ul>
			<p>The main template performs the following actions:</p>
			<ul>
				<li>Print the basic XHTML structure</li>
				<li>Extract global information and place it correctly into XHTML</li>
				<li>Call sub templates for more complex operations</li>
			</ul>
			<code type="xml"><![CDATA[
<xsl:template match="presentation">
	<html>
		<head>
			<title><xsl:value-of select="general/title[1]" /></title>
			<xsl:apply-templates match="options/stylesheet" />
			
			<script language="javascript" src="../app/xmlpres.js" />
		</head>
		<body onload="new JXmlpres();">
<!-- ... -->
			]]></code>
		</slide>
		<slide title="&lt;xsl:for-each&gt; and &lt;xsl:element&gt;">
			<p><![CDATA[<xsl:for-each>]]></p>
			<ul>
				<li>Iterates through a given set of nodes</li>
				<li>Node set (as usual) defines using XPath</li>
			</ul>
			<p><![CDATA[<xsl:element>]]></p>
			<ul>
				<li>Used to create a complex XML element</li>
				<li>Enables you to define tag names dynamically</li>
				<li>Allows to add attributes dynamically</li>
			</ul>
			<code type="xml"><![CDATA[
<!-- ... -->
<div id="slide0" class="slide">
	<div class="innerSlide">
		<div class="title">
			<xsl:for-each select="general/title">
				<xsl:element name="h{position()}">
					<xsl:value-of select="." />
				</xsl:element>
			</xsl:for-each>
		</div>
		<div class="author">
			<xsl:for-each select="general/author">
				<div><xsl:value-of select="." /></div>
			</xsl:for-each>                            
		</div>
		<div class="location">
			<xsl:value-of select="general/location" />
		</div>
		<div class="date">
			<xsl:value-of select="general/date" />
		</div>
	</div>
</div>
<!-- ... -->
			]]></code>
			<code type="xml"><![CDATA[
<!-- ... -->
			<xsl:for-each select="slides/slide">
				<div id="slide{position()}" class="slide">
					<h1 class="title"><xsl:value-of select="@title" /></h1>
					<div class="innerSlide">
						<xsl:apply-templates />
					</div>
				</div>
			</xsl:for-each>
		</body>
	</html>
</xsl:template>
			]]></code>
		</slide>
		<slide title="Further templates...">
			<code type="xml"><![CDATA[
<xsl:template match="options/stylesheet">
	<link rel="stylesheet" type="text/css" media="all" href="../styles/{.}" />
</xsl:template>

<xsl:template match="ul|li|p|center">
	<xsl:copy>
		<xsl:apply-templates />
	</xsl:copy>
</xsl:template>

<xsl:template match="image">
	<img src="{.}" />
</xsl:template>
			]]></code>
			<code type="xml"><![CDATA[
<xsl:template match="code">
	<textarea name="code">
		<xsl:attribute name="class"><xsl:value-of select="@type" />:nocontrols</xsl:attribute>
		<xsl:value-of select="." /> 
	</textarea>
</xsl:template>

<xsl:template match="general"></xsl:template>
<xsl:template match="options">
	<xsl:apply-templates match="options/stylesheet" />
</xsl:template>
<xsl:template match="slides"></xsl:template>
			]]></code>
		</slide> 
		<slide title="The result">
			<p>Translated using our XSLT template...</p>
			<p>... is currently displayed here! :)</p>
		</slide>
		<slide title="Conclusion">
			<p>What have you learned today?</p>
			<ul>
				<li>How to select specific portions of an XML document using <strong>XPath</strong></li>
				<li>How a specific XML format can be converted into another format using <strong>XSLT</strong></li>
				<li>How <strong>XPath</strong> is used in <strong>XSLT</strong></li>
			</ul>
			<p>What is still missing?</p>
			<ul>
				<li>XPath supports a lot more functions</li>
				<li>
					XSLT has some more constructs like
					<ul>
					 	<li>conditions (if-then-else)</li>
						<li>choosinging (switch)</li>
					</ul>
				</li>
			</ul>
			<p>Where can I learn more?</p>
			<ul>
				<li>
					<strong>XPath</strong>:
					<ul>
						<li>http://de.wikipedia.org/wiki/Xslt</li>
						<li>http://www.w3schools.com/xpath/</li>
						<li>http://www.unidex.com/turing/utm.htm</li>
					</ul>
				</li>
				<li><strong>XSLT</strong>:
					<ul>
						<li>http://www.w3schools.com/xsl/</li>
					</ul>
				</li>
			</ul>
		</slide>
		<slide title="The end">
			<p>Thank you for listening!</p>
			<ul>
				<li>We hope you enjoyed the talk and learned what you expected!</li>
				<li>If you have questions, please ask now! :)</li>
				<li>
					This presentation can be found online here:
					<ul>
						<li>svn://svn.pureenergy.cc/xmlpres</li>
						<li>http://schlitt.info/uni/xmlpres/presentations/xsd-xsl.xml</li>
					</ul>
				</li>
			</ul>
			<p>If you have questions later:</p>
			<ul>
				<li>This meeting will happen some more times... ;)</li>
				<li>
					Send us an email:
					<ul>
						<li>Jakob Westhoff &lt;jakob@php.net&gt;</li>
						<li>Tobias Schlitt &lt;toby@php.net&gt;</li>
					</ul>
				</li>
			</ul>
		</slide>
	</slides>
	<!-- http://www.unidex.com/turing/utm.htm Turing Maschine -->
</presentation>
