Purgis: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 29: | Line 29: | ||
</menyy> | </menyy> | ||
<teenindajad> | <teenindajad> | ||
<teenindaja>![CDATA[Maali]]</teenindaja> | <teenindaja id="1">![CDATA[Maali]]</teenindaja> | ||
<teenindaja>![CDATA[Juhan]]</teenindaja> | <teenindaja id="2">![CDATA[Juhan]]</teenindaja> | ||
<teenindaja>![CDATA[Juta]]</teenindaja> | <teenindaja id="3">![CDATA[Juta]]</teenindaja> | ||
</teenindajad> | </teenindajad> | ||
<nimi>![CDATA[NOA restoran]]</nimi> | <nimi>![CDATA[NOA restoran]]</nimi> | ||
<lauad> | <lauad> | ||
<laud id="1" > | <laud id="1" > | ||
<tellimused> | <tellimused teenindajaId="1"> | ||
<tellimus valmis="false" tellimuseAeg="1702301843" taimneVersioon="true"> | <tellimus valmis="false" tellimuseAeg="1702301843" taimneVersioon="true"> | ||
<jook>![CDATA[Apelsinimahl]]</jook> | <jook>![CDATA[Apelsinimahl]]</jook> | ||
Line 58: | Line 58: | ||
<laud id="2" > | <laud id="2" > | ||
<tellimused> | <tellimused teenindajaId="2"> | ||
<tellimus valmis="false" tellimuseAeg="1702301852"> | <tellimus valmis="false" tellimuseAeg="1702301852"> | ||
<jook>![CDATA[Fanta]]</jook> | <jook>![CDATA[Fanta]]</jook> | ||
Line 72: | Line 72: | ||
<laud id="3" > | <laud id="3" > | ||
<tellimused> | <tellimused teenindajaId="3"> | ||
<tellimus valmis="false" tellimuseAeg="1702301903" taimneVersioon="true"> | <tellimus valmis="false" tellimuseAeg="1702301903" taimneVersioon="true"> | ||
<jook>![CDATA[Fanta]]</jook> | <jook>![CDATA[Fanta]]</jook> | ||
Line 103: | Line 103: | ||
<xs:complexType> | <xs:complexType> | ||
<xs:sequence> | <xs:sequence> | ||
<xs:element name="menyy"> | |||
<xs:complexType> | <xs:complexType> | ||
<xs:sequence> | <xs:sequence> | ||
Line 122: | Line 122: | ||
</xs:sequence> | </xs:sequence> | ||
</xs:complexType> | </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 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:boolean" name="valmis" use="required"/> | |||
<xs:attribute type="xs:unsignedInt" name="tellimuseAeg" use="required"/> | |||
<xs:attribute type="xs:boolean" name="taimneVersioon"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute type="xs:int" name="teenindajaId"/> | |||
</xs:complexType> | </xs:complexType> | ||
</xs:element> | </xs:element> | ||
</xs:sequence> | </xs:sequence> | ||
<xs:attribute type="xs:int" name="id | <xs:attribute type="xs:int" name="id"/> | ||
</xs:complexType> | </xs:complexType> | ||
</xs:element> | </xs:element> | ||
Line 173: | Line 173: | ||
=== XSLT === | === XSLT === | ||
==XSLT HTML== | |||
==Restoranide id== | ==Restoranide id== | ||
Line 186: | Line 188: | ||
<head> | <head> | ||
<title>Order fast/fi</title> | <title>Order fast/fi</title> | ||
<h2> | |||
<xsl:value-of select="/restoranid/restoran/nimi> | |||
</h2> | |||
</head> | </head> | ||
Line 191: | Line 196: | ||
<ul> | <ul> | ||
<xsl:for-each select="/restoranid/restoran"> | <xsl:for-each select="/restoranid/restoran"> | ||
<li> | <li> | ||
<xsl:value-of select="@id" /> | <xsl:value-of select="@id" /> | ||
Line 203: | Line 207: | ||
</xsl:for-each> | </xsl:for-each> | ||
</ul> | </ul> | ||
</xsl:for-each> | </xsl:for-each> | ||
</ul> | </ul> | ||
</body> | </body> | ||
</html> | </html> | ||
Line 226: | Line 227: | ||
<head> | <head> | ||
<title>Order fast/fi</title> | <title>Order fast/fi</title> | ||
<h2> | |||
<xsl:value-of select="/restoranid/restoran/nimi> | |||
</h2> | |||
</head> | </head> | ||
Line 231: | Line 235: | ||
<ul> | <ul> | ||
<xsl:for-each select="/restoranid/restoran"> | <xsl:for-each select="/restoranid/restoran"> | ||
<li> | <li> | ||
<xsl:value-of select="@id" /> | <xsl:value-of select="@id" /> | ||
</li> | </li> | ||
<ul> | <ul> | ||
<xsl:for-each select="teenindajad/teenindaja"> | <xsl:for-each select="teenindajad/teenindaja"> | ||
Line 244: | Line 247: | ||
</xsl:for-each> | </xsl:for-each> | ||
</ul> | </ul> | ||
</xsl:for-each> | </xsl:for-each> | ||
</ul> | </ul> | ||
</body> | </body> | ||
</html> | </html> | ||
Line 254: | Line 254: | ||
</xsl:stylesheet> | </xsl:stylesheet> | ||
</source> | </source> | ||
==XSLT XML== | |||
<?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="xml" indent="yes"/> | |||
<xsl:template match="/"> | |||
<restoranid> | |||
<xsl:for-each select="/restoranid/restoran"> | |||
<restoran> | |||
<nimi> | |||
<xsl:value-of select="nimi"/> | |||
</nimi> | |||
<xsl:variable name="tellimusId" select="@id"/> | |||
<teenindaja> | |||
<xsl:copy-of select="/restoranid/restoran/teenindajad/teenindaja[@id=$teeenindajaId]" /> | |||
</teenindaja> | |||
<tellimused> | |||
<xsl:for-each select="tellimused/tellimus"> | |||
<xsl:variable name="taimneVersioon" select="@taimneVersioon"/> | |||
<tellimus> | |||
<toit> | |||
<xsl:value-of select="." /> | |||
</toit> | |||
<xsl:copy-of select="/restoranid/restoran/lauad/laud/tellimused/tellimus[@taimneVersioon=$taimneVersioon]/toit" /> | |||
</tellimus> | |||
</xsl:for-each> | |||
</tellimused> | |||
</restoran> | |||
</xsl:for-each> | |||
</restoranid> | |||
</xsl:template> | |||
</xsl:stylesheet> |
Revision as of 23:47, 20 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>
<jook>![CDATA[Sprite]]</jook>
</joogid>
</menyy>
<teenindajad>
<teenindaja id="1">![CDATA[Maali]]</teenindaja>
<teenindaja id="2">![CDATA[Juhan]]</teenindaja>
<teenindaja id="3">![CDATA[Juta]]</teenindaja>
</teenindajad>
<nimi>![CDATA[NOA restoran]]</nimi>
<lauad>
<laud id="1" >
<tellimused teenindajaId="1">
<tellimus valmis="false" tellimuseAeg="1702301843" taimneVersioon="true">
<jook>![CDATA[Apelsinimahl]]</jook>
<toit>![CDATA[Oasalat]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301844">
<jook>![CDATA[Segumahl]]</jook>
<toit>![CDATA[Seapraad]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301846" taimneVersioon="true">
<jook>![CDATA[Sprite]]</jook>
<toit>![CDATA[Oasalat]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301847">
<jook>![CDATA[Fanta]]</jook>
<toit>![CDATA[Fetasalat]]</toit>
</tellimus>
</tellimused>
<teenindaja>![CDATA[Maali]]</teenindaja>
</laud>
<laud id="2" >
<tellimused teenindajaId="2">
<tellimus valmis="false" tellimuseAeg="1702301852">
<jook>![CDATA[Fanta]]</jook>
<toit>![CDATA[Fetasalat]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301853">
<jook>![CDATA[Coca-cola]]</jook>
<toit>![CDATA[Fetasalat]]</toit>
</tellimus>
</tellimused>
<teenindaja>![CDATA[Juhan]]</teenindaja>
</laud>
<laud id="3" >
<tellimused teenindajaId="3">
<tellimus valmis="false" tellimuseAeg="1702301903" taimneVersioon="true">
<jook>![CDATA[Fanta]]</jook>
<toit>![CDATA[Oasalat]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301905">
<jook>![CDATA[Apelsinimahl]]</jook>
<toit>![CDATA[Fetasalat]]</toit>
</tellimus>
<tellimus valmis="false" tellimuseAeg="1702301906">
<jook>![CDATA[Coca-cola]]</jook>
<toit>![CDATA[Kanapraad]]</toit>
</tellimus>
</tellimused>
<teenindaja>![CDATA[Juta]]</teenindaja>
</laud>
</lauad>
</restoran>
</restoranid>
XSD
<?xml version="1.0" encoding="utf-8"?>
<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="menyy">
<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: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 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:boolean" name="valmis" use="required"/>
<xs:attribute type="xs:unsignedInt" name="tellimuseAeg" use="required"/>
<xs:attribute type="xs:boolean" name="taimneVersioon"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:int" name="teenindajaId"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:int" name="id"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:int" name="id"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT
XSLT HTML
Restoranide 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>
<h2>
<xsl:value-of select="/restoranid/restoran/nimi>
</h2>
</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>
Restoranide 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>
<h2>
<xsl:value-of select="/restoranid/restoran/nimi>
</h2>
</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>
XSLT XML
<?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="xml" indent="yes"/> <xsl:template match="/"> <restoranid> <xsl:for-each select="/restoranid/restoran"> <restoran> <nimi> <xsl:value-of select="nimi"/> </nimi> <xsl:variable name="tellimusId" select="@id"/> <teenindaja> <xsl:copy-of select="/restoranid/restoran/teenindajad/teenindaja[@id=$teeenindajaId]" /> </teenindaja> <tellimused> <xsl:for-each select="tellimused/tellimus"> <xsl:variable name="taimneVersioon" select="@taimneVersioon"/> <tellimus> <toit> <xsl:value-of select="." /> </toit> <xsl:copy-of select="/restoranid/restoran/lauad/laud/tellimused/tellimus[@taimneVersioon=$taimneVersioon]/toit" /> </tellimus> </xsl:for-each> </tellimused> </restoran> </xsl:for-each> </restoranid> </xsl:template> </xsl:stylesheet>