<html>
<head>
<body>
<p>a paragraph…<br>
<a href=“#”>test
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>…</title>
</head>
<body>
…
</body>
</html>
<!DOCTYPE course [
<!ELEMENT course (lecture+)>
<!ELEMENT lecture (title,bibliography,notes,examples)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT bibliography (#PCDATA)>
<!ELEMENT notes (#PCDATA)>
<!ELEMENT examples (#PCDATA)>
<!ATTLIST course professor CDATA #REQUIRED>
<!ATTLIST course title CDATA #REQUIRED>
<!ATTLIST course yearofstudy CDATA #REQUIRED>
<!ATTLIST course date CDATA #IMPLIED>
]>
<?xml version=“1.0”?>
<collection>
<book category=“Networking”>
<title>High Performance TCP Networking</title>
<author>Raj Jain</author>
<isbn>567-78960</isbn>
<editor>Prentice Hall</editor>
</book>
<book category=“Databases”>
<title>Transactional Information Systems</title>
<author>Gottfried Vossen</author>
<author>Gerhard Weikum</author>
<isbn>680-71060</isbn>
<editor>Morkan Kaufman Publishing</editor>
</book>
<book category=“Mathematics”>
<title>Mathematical Encyclopedia</title>
<author>Eric Weistein</author>
<isbn>545-678450</isbn>
<editor>Addison Wesley</editor>
</book>
</collection>
<!ELEMENT collection (book+)>
<!ELEMENT book (title,author+,isbn,editor)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT isbn (#PCDATA)>
<!ELEMENT editor (#PCDATA)>
<!ATTLIST book category CDATA #REQUIRED>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name=“collection">
<xs:complexType>
<xs:sequence>
<xs:element name=“book">
<xs:complexType>
<xs:attribute name=“category” type=“xs:string” />
<xs:sequence>
<xs:element name=“title" type="xs:string"/>
<xs:element name=“author" type="xs:string“
minOccurs=“1” maxOccurs=“10” />
<xs:element name=“isbn" type="xs:string"/>
<xs:element name=“editor" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<document>
<studies>
<year_of_study name=“1”>
<group>211</group>
<group>212</group>
</year_of_study>
<year_of_study name=“2”>
…
</year_o_study>
</studies>
<courses>
<group name=“Databases”>
<course>Relational Databases</course>
<course>Database Systems Fundamentals</course>
</group>
<group name=“Operating Systems”>
…
</group>
</courses>
</document>
<document>
<st:studies xmlns:st=“http://www.cs.ubbcluj.ro/studies”>
<st:year_of_study name=“1”>
<st:group>211</st:group>
<st:group>212</st:group>
</st:year_of_study>
<st:year_of_study name=“2”>
…
</st:year_o_study>
</st:studies>
<co:courses xmlns:co=“http://www.cs.ubbcluj.ro/courses”>
<co:group name=“Databases”>
<co:course>Relational Databases</co:course>
<co:course>Database Systems Fundamentals</co:course>
</co:group>
<co:group name=“Operating Systems”>
…
</co:group>
</co:courses>
</document>
book { title {
display: block; display: inline-block;
border-bottom-style: solid; width: 30%;
border-bottom-width: 1px; background-color: #ccefef;
width: 80%; padding-right: 5px;
margin-left: auto; }
margin-right: auto;
} isbn {
display: inline-block;
author { width: 15%;
display: inline-block; border-left-style: solid;
width: 15%; border-left-width: 1px;
border-left-style: solid; padding-left: 5px;
border-left-width: 1px; }
padding-left: 5px;
}
editor {
display: inline-block;
width: 20%;
border-left-style: solid;
border-left-width: 1px;
padding-left: 5px;
}
href="http://www.example.com/cdlist.xml#id('rock').child(5,item)"
<homepage xlink:type="simple"
xlink:href="http://www.w3schools.com">Visit W3Schools</homepage>
<?xml version=“1.0”?>
<xsl:stylesheet version=“1.0“ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>A Book Collection</h2>
<table border=“1”>
<xsl:for-each select=“collection/book”>
<tr>
<td><xsl:value-of select=“title”/></td>
<td><xsl:value-of select=“author”/></td>
<td><xsl:value-of select=“isbn”/></td>
<td><xsl:value-of select=“editor”/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml-stylesheet type=“text/xsl” href=“book.xsl”?>
<xsl:template match=“XPath expression”>…</xsl:template>
<xsl:value-of select=“XPath expression” />
<xsl:value-of select=“collection/book/title” />
it selects the value of the current “title” element, which is a child of “book”, which is a child of “collection”
<xsl:for-each select=“XPath expression”>…</xsl:for-each>
1) <xsl:for-each select=“collection/book”>
<xsl:value-of select=“title” />
<xsl:value-of select=“author” />
</xsl:for-each>
it selects the “title” and “author” nodes which are children of all “book” nodes from a “collection” node
2) <xsl:for-each select=“collection/book[title=“Operating Systems”]>
it filters the selection using a value for the content of a book node
<xsl:sort select=“XPath expression” />
<xsl:sort select=“title” />
<xsl:if test=“expression”>
… output in case the expression is true …
</xsl:if>
<xsl:if test=“title=‘Operating Systems’”>…</xsl;if>
<xsl:choose>
<xsl:when test="expression">
... some output ...
</xsl:when>
<xsl:otherwise>
... some output ....
</xsl:otherwise>
</xsl:choose>