MeilEiOleGrupinime
From ICO wiki
Kodutöö aines "Võrgurakendused II: hajussüsteemide ehitamine"
Meeskonna nimi : MeilEiOleGrupinime
Meeskonna koosseis
- Jander Lapmaa
- Kristjan Oliver Kruus
- Rene Hollo
- Mihkel Ehrlich
Projektijuht on Mihkel Ehrlich
Kodutöö osa: XML
Tähtaeg: 08.03.2014
Esitatud: 09.03.2014 00:02
XML koos näiteandmetega
<?xml version="1.0" encoding="utf-8"?> <personsList> <person ID="1" FirstName="Test" LastName="Vend"> <shoppingLists> <shoppingList ID="1" Name="Reede"> <product ID="1000" Quantity="10" QuantityType="Numeric"><![CDATA[Walter 7% 2l]]></product> <product ID="2" Quantity="2" QuantityType="Kilos"><![CDATA[Küpsis]]></product> <product ID="4" Quantity="1" QuantityType="Numeric"><![CDATA[Kilekott]]></product> <product ID="5" Name="" Quantity="2" QuantityType="Kilos"><![CDATA[Orbit]]></product> </shoppingList> <shoppingList ID="2" Name="Hommikuks ka midagi"> <product ID="1" Quantity="2" QuantityType="Numeric"><![CDATA[Walter 7% 2l]]></product> <product ID="6" Quantity="2" QuantityType="Numeric"><![CDATA[Fazer leib]]></product> </shoppingList> </shoppingLists> </person> <person ID="1" FirstName="Mart" LastName="Karask"> <shoppingLists> <shoppingList ID="1" Name="Tavaline"> <product ID="1000" Quantity="1000" QuantityType="Numeric"><![CDATA[Sai]]></product> <product ID="2" Quantity="2" QuantityType="Kilos"><![CDATA[Kommid]]></product> <product ID="3" Quantity="1" QuantityType="Numeric"><![CDATA[Jogurt]]></product> <product ID="4" Quantity="1" QuantityType="Numeric"><![CDATA[Vorst]]></product> </shoppingList> <shoppingList ID="2" Name="Pelmeenid"> <product ID="1" Quantity="1" QuantityType="Numeric"><![CDATA[Pakk pelmeene]]></product> <product ID="8" Quantity="2" QuantityType="Numeric"><![CDATA[500g hapukoor]]></product> </shoppingList> <shoppingList ID="3" Name="Kukesupp"> <product ID="7" Quantity="3" QuantityType="Kilos"><![CDATA[Kukk]]></product> <product ID="9" Quantity="3" QuantityType="Numeric"><![CDATA[Supp]]></product> </shoppingList> </shoppingLists> </person> <person ID="1" FirstName="Muri" LastName="Kaimers"> <shoppingLists> <shoppingList ID="1" Name="asdf"> <product ID="1" Quantity="1" QuantityType="Numeric"><![CDATA[Wrap]]></product> <product ID="2" Quantity="1" QuantityType="Numeric"><![CDATA[Kohipakk 200g]]></product> <product ID="5" Quantity="1" QuantityType="Numeric"><![CDATA[Razer Naga]]></product> </shoppingList> <shoppingList ID="2" Name="asd"> <product ID="1" Quantity="10" QuantityType="Numeric"><![CDATA[Munad]]></product> <product ID="6" Quantity="2" QuantityType="Numeric"><![CDATA[Fazer leib]]></product> </shoppingList> </shoppingLists> </person> </personsList>
XML skeemifail
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="personsList"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="person"> <xs:complexType> <xs:sequence> <xs:element name="shoppingLists"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="shoppingList"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="product"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="ID" type="xs:unsignedInt" use="required" /> <xs:attribute name="Quantity" type="xs:decimal" use="required" /> <xs:attribute name="QuantityType" type="xs:string" use="required" /> <xs:attribute name="Name" type="xs:string" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="ID" type="xs:unsignedInt" use="required" /> <xs:attribute name="Name" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="ID" type="xs:unsignedInt" use="required" /> <xs:attribute name="FirstName" type="xs:string" use="required" /> <xs:attribute name="LastName" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
XSLT failid
<?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>Inimeste ostunimekirjad</title> </head> <body> <xsl:for-each select="/personsList/person"> <h1>Isik: <xsl:value-of select="@FirstName"/> <xsl:value-of select="@LastName"/></h1> <xsl:for-each select="shoppingLists/shoppingList"> <xsl:variable name="list" select="."></xsl:variable> <table> <th>Ostunimekiri "<xsl:value-of select="$list/@Name"/>"</th> <xsl:for-each select="$list/product"> <tr> <td><xsl:value-of select="."/></td> <td><xsl:value-of select="@Quantity"/></td> <td> <xsl:choose> <xsl:when test="@QuantityType='Numeric'"> tükki </xsl:when> <xsl:when test="@QuantityType='Kilos'"> kilo </xsl:when> </xsl:choose> </td> </tr> </xsl:for-each> </table> <br /> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
<?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>Inimeste ostunimekirjad</title> </head> <body> <xsl:for-each select="/personsList/person"> <xsl:if test="@FirstName='Mart' and @LastName='Karask'"> <xsl:variable name="selectedPerson" select="."></xsl:variable> <p> Isik: <xsl:value-of select="$selectedPerson/@FirstName"/> <xsl:value-of select="$selectedPerson/@LastName"/> </p> <xsl:for-each select="shoppingLists/shoppingList"> <xsl:variable name="list" select="."></xsl:variable> <xsl:if test="$list/@Name='Tavaline'"> <table> <th> Ostunimekiri "<xsl:value-of select="$list/@Name"/>" </th> <xsl:for-each select="$list/product"> <tr> <td> <xsl:value-of select="."/> </td> <td> <xsl:value-of select="@Quantity"/> </td> <td> <xsl:choose> <xsl:when test="@QuantityType='Numeric'"> tükki </xsl:when> <xsl:when test="@QuantityType='Kilos'"> kilo </xsl:when> </xsl:choose> </td> </tr> </xsl:for-each> </table> <br /> </xsl:if> </xsl:for-each> </xsl:if> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
Kodutöö osa: Veebiteenus
Tähtaeg: 25.05.2014
Kodutöö osa: Klientrakendus
Tähtaeg: 25.05.2014