Purgis: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Created page with "=Kodutöö aines "Võrgurakendused II: hajussüsteemide ehitamine"= ==Meeskond== *Märt Lõhmus *Kelli Lukas" |
|||
Line 4: | Line 4: | ||
*Märt Lõhmus | *Märt Lõhmus | ||
*Kelli Lukas | *Kelli Lukas | ||
=XML/XSD/XSLT= | |||
=== XML === | |||
<pre> | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<restoranid> | |||
<restoran id="1"> | |||
<menyy> | |||
<toidud> | |||
<toit>![CDATA[Kanapraad]]</toit> | |||
<toit>![CDATA[Seapraad]]</toit> | |||
<toit>![CDATA[Fetasalat]]</toit> | |||
<toit>![CDATA[Oasalat]]</toit> | |||
</toidud> | |||
<joogid> | |||
<jook>![CDATA[Apelsinimahl]]</jook> | |||
<jook>![CDATA[Segumahl]]</jook> | |||
<jook>![CDATA[Coca-cola]]</jook> | |||
<jook>![CDATA[Fanta]]</jook> | |||
</joogid> | |||
</menyy> | |||
<teenindajad> | |||
<teenindaja>![CDATA[Maali]]</teenindaja> | |||
<teenindaja>![CDATA[Juhan]]</teenindaja> | |||
<teenindaja>![CDATA[Juta]]</teenindaja> | |||
</teenindajad> | |||
<nimi>![CDATA[NOA restoran]]</nimi> | |||
<lauad> | |||
<laud id="1" > | |||
<tellimused> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Apelsinimahl]]</jook> | |||
<toit>![CDATA[Oasalat]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Segumahl]]</jook> | |||
<toit>![CDATA[Seapraad]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Segumahl]]</jook> | |||
<toit>![CDATA[Oasalat]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Fanta]]</jook> | |||
<toit>![CDATA[Fetasalat]]</toit> | |||
</tellimus> | |||
</tellimused> | |||
<teenindaja>![CDATA[Maali]]</teenindaja> | |||
</laud> | |||
<laud id="2" > | |||
<tellimused> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Fanta]]</jook> | |||
<toit>![CDATA[Fetasalat]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Coca-cola]]</jook> | |||
<toit>![CDATA[Fetasalat]]</toit> | |||
</tellimus> | |||
</tellimused> | |||
<teenindaja>![CDATA[Juhan]]</teenindaja> | |||
</laud> | |||
<laud id="3" > | |||
<tellimused> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Fanta]]</jook> | |||
<toit>![CDATA[Oasalat]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Apelsinimahl]]</jook> | |||
<toit>![CDATA[Fetasalat]]</toit> | |||
</tellimus> | |||
<tellimus valmis="false"> | |||
<jook>![CDATA[Coca-cola]]</jook> | |||
<toit>![CDATA[Kanapraad]]</toit> | |||
</tellimus> | |||
</tellimused> | |||
<teenindaja>![CDATA[Juta]]</teenindaja> | |||
</laud> | |||
</lauad> | |||
</restoran> | |||
</restoranid> | |||
</pre> | |||
=== XSD === | |||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||
<xs:element name="restoranid"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="restoran"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="toidud"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="toit" maxOccurs="unbounded" minOccurs="0"/> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="joogid"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="jook" maxOccurs="unbounded" minOccurs="0"/> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="teenindajad"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="teenindaja" maxOccurs="unbounded" minOccurs="0"/> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element type="xs:string" name="nimi"/> | |||
<xs:element type="xs:byte" name="kohtadeArv"/> | |||
<xs:element name="lauad"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="laud" maxOccurs="unbounded" minOccurs="0"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="tellimused"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="tellimus" maxOccurs="unbounded" minOccurs="0"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="jook"/> | |||
<xs:element type="xs:string" name="toit"/> | |||
</xs:sequence> | |||
<xs:attribute type="xs:string" name="valmis" use="optional"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element type="xs:string" name="teenindaja"/> | |||
</xs:sequence> | |||
<xs:attribute type="xs:byte" name="id" use="optional"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute type="xs:byte" name="id"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:schema> | |||
=== XSLT === | |||
==resturanide id== | |||
<pre> | |||
<?xml version="1.0" encoding\="utf-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> | |||
<xsl:output method="html" indent="yes"/> | |||
<xsl:template match="/"> | |||
<html> | |||
<head> | |||
<title>Order fast/fi</title> | |||
</head> | |||
<body> | |||
<ul> | |||
<xsl:for-each select="/restoranid/restoran"> | |||
<li> | |||
<xsl:value-of select="@id" /> | |||
</li> | |||
<ul> | |||
<xsl:for-each select="toidud/toit"> | |||
<li> | |||
<xsl:value-of select="." /> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:for-each> | |||
</ul> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</pre> | |||
==resturanide toidud== | |||
<pre> | |||
<?xml version="1.0" encoding\="utf-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> | |||
<xsl:output method="html" indent="yes"/> | |||
<xsl:template match="/"> | |||
<html> | |||
<head> | |||
<title>Order fast/fi</title> | |||
</head> | |||
<body> | |||
<ul> | |||
<xsl:for-each select="/restoranid/restoran"> | |||
<li> | |||
<xsl:value-of select="@id" /> | |||
</li> | |||
<ul> | |||
<xsl:for-each select="teenindajad/teenindaja"> | |||
<xsl:sort select="."/> | |||
<li> | |||
<xsl:value-of select="." /> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:for-each> | |||
</ul> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</pre> |
Revision as of 15:45, 19 March 2017
Kodutöö aines "Võrgurakendused II: hajussüsteemide ehitamine"
Meeskond
- Märt Lõhmus
- Kelli Lukas
XML/XSD/XSLT
XML
<?xml version="1.0" encoding="utf-8" ?> <restoranid> <restoran id="1"> <menyy> <toidud> <toit>![CDATA[Kanapraad]]</toit> <toit>![CDATA[Seapraad]]</toit> <toit>![CDATA[Fetasalat]]</toit> <toit>![CDATA[Oasalat]]</toit> </toidud> <joogid> <jook>![CDATA[Apelsinimahl]]</jook> <jook>![CDATA[Segumahl]]</jook> <jook>![CDATA[Coca-cola]]</jook> <jook>![CDATA[Fanta]]</jook> </joogid> </menyy> <teenindajad> <teenindaja>![CDATA[Maali]]</teenindaja> <teenindaja>![CDATA[Juhan]]</teenindaja> <teenindaja>![CDATA[Juta]]</teenindaja> </teenindajad> <nimi>![CDATA[NOA restoran]]</nimi> <lauad> <laud id="1" > <tellimused> <tellimus valmis="false"> <jook>![CDATA[Apelsinimahl]]</jook> <toit>![CDATA[Oasalat]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Segumahl]]</jook> <toit>![CDATA[Seapraad]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Segumahl]]</jook> <toit>![CDATA[Oasalat]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Fanta]]</jook> <toit>![CDATA[Fetasalat]]</toit> </tellimus> </tellimused> <teenindaja>![CDATA[Maali]]</teenindaja> </laud> <laud id="2" > <tellimused> <tellimus valmis="false"> <jook>![CDATA[Fanta]]</jook> <toit>![CDATA[Fetasalat]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Coca-cola]]</jook> <toit>![CDATA[Fetasalat]]</toit> </tellimus> </tellimused> <teenindaja>![CDATA[Juhan]]</teenindaja> </laud> <laud id="3" > <tellimused> <tellimus valmis="false"> <jook>![CDATA[Fanta]]</jook> <toit>![CDATA[Oasalat]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Apelsinimahl]]</jook> <toit>![CDATA[Fetasalat]]</toit> </tellimus> <tellimus valmis="false"> <jook>![CDATA[Coca-cola]]</jook> <toit>![CDATA[Kanapraad]]</toit> </tellimus> </tellimused> <teenindaja>![CDATA[Juta]]</teenindaja> </laud> </lauad> </restoran> </restoranid>
XSD
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="restoranid"> <xs:complexType> <xs:sequence> <xs:element name="restoran"> <xs:complexType> <xs:sequence> <xs:element name="toidud"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="toit" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="joogid"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="jook" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="teenindajad"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="teenindaja" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element type="xs:string" name="nimi"/> <xs:element type="xs:byte" name="kohtadeArv"/> <xs:element name="lauad"> <xs:complexType> <xs:sequence> <xs:element name="laud" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="tellimused"> <xs:complexType> <xs:sequence> <xs:element name="tellimus" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="jook"/> <xs:element type="xs:string" name="toit"/> </xs:sequence> <xs:attribute type="xs:string" name="valmis" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element type="xs:string" name="teenindaja"/> </xs:sequence> <xs:attribute type="xs:byte" name="id" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute type="xs:byte" name="id"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element>
</xs:schema>
XSLT
resturanide id
<?xml version="1.0" encoding\="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <head> <title>Order fast/fi</title> </head> <body> <ul> <xsl:for-each select="/restoranid/restoran"> <li> <xsl:value-of select="@id" /> </li> <ul> <xsl:for-each select="toidud/toit"> <li> <xsl:value-of select="." /> </li> </xsl:for-each> </ul> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet>
resturanide toidud
<?xml version="1.0" encoding\="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <head> <title>Order fast/fi</title> </head> <body> <ul> <xsl:for-each select="/restoranid/restoran"> <li> <xsl:value-of select="@id" /> </li> <ul> <xsl:for-each select="teenindajad/teenindaja"> <xsl:sort select="."/> <li> <xsl:value-of select="." /> </li> </xsl:for-each> </ul> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet>