Rent a bike
From ICO wiki
Meeskond: rent-A-bike
- Erika Ehmann
I osa
Teema
On firma, mis tegeleb rattarendiga. Firmal on mitmeid tüüpi rattaid, mis võivad asuda erinevates kohtades, kust neid rentida saab.
XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="bikerenttt.xslt"?>
<BikeRent>
<Bikes>
<Bike Type="Mountain Bike" Code="000001" Colour="White" Size="Medium" Name="FASTER_XS">
<PriceDay validFrom="2016-10-01">
<Amount>20</Amount>
<Currency>EUR</Currency>
</PriceDay>
<PriceHour validFrom="2016-10-01">
<Amount>4</Amount>
<Currency>EUR</Currency>
</PriceHour>
<Image><![CDATA[http://www.bicycling.com/sites/bicycling.com/files/styles/slideshow-desktop/public/blizzard-50-556.jpg?itok=kW--9dkX]]></Image>
<AdditionalInfo>2014</AdditionalInfo>
<PickupPoints>
<PickupPoint ID="1">
<Address>Tallinn, Kopli 69n-2</Address>
<AdditionalInfo>Esimene korrus, nurga taga</AdditionalInfo>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
</OpenTimes>
</PickupPoint>
<PickupPoint ID="2">
<Address>Tartu mnt. 45</Address>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
<OpenTime ID="6" day="Saturday" time="10:00-20:00" />
<OpenTime ID="7" day="Sunday" time="12:00-20:00" />
</OpenTimes>
</PickupPoint>
</PickupPoints>
</Bike>
<Bike Type="Mountain Bike" Code="000002" Colour="White" Size="Medium" Name="MUCH MOUNTAIN">
<PriceDay validFrom="2016-10-01">
<Amount>23</Amount>
<Currency>EUR</Currency>
</PriceDay>
<PriceHour validFrom="2016-10-01">
<Amount>5</Amount>
<Currency>EUR</Currency>
</PriceHour>
<Image><![CDATA[http://www.bikes.com/sites/default/files/models/Pipeline_770-MSL.jpg]]></Image>
<AdditionalInfo>2014</AdditionalInfo>
<PickupPoints>
<PickupPoint ID="1">
<Address>Tallinn, Kopli 69n-2</Address>
<AdditionalInfo>Esimene korrus, nurga taga</AdditionalInfo>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
</OpenTimes>
</PickupPoint>
</PickupPoints>
</Bike>
<Bike Type="City Bike" Code="000003" Colour="Red" Size="Large" Name="Dainty Lady 88">
<PriceDay validFrom="2016-10-01">
<Amount>25</Amount>
<Currency>EUR</Currency>
</PriceDay>
<PriceHour validFrom="2016-10-01">
<Amount>5</Amount>
<Currency>EUR</Currency>
</PriceHour>
<Image><![CDATA[https://momentummag.com/wp-content/uploads/2015/01/Sommer-red-high-res-RESIZED.jpg]]></Image>
<AdditionalInfo>2010</AdditionalInfo>
<PickupPoints>
<PickupPoint ID="2">
<Address>Tartu mnt. 45</Address>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
<OpenTime ID="6" day="Saturday" time="10:00-20:00" />
<OpenTime ID="7" day="Sunday" time="12:00-20:00" />
</OpenTimes>
</PickupPoint>
<PickupPoint ID="3">
<Address>Pärnu mnt. 100</Address>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
<OpenTime ID="6" day="Saturday" time="10:00-20:00" />
</OpenTimes>
</PickupPoint>
<PickupPoint ID="4">
<Address>Mäepealse 8</Address>
<AdditionalInfo>Majaesine parem uks</AdditionalInfo>
<OpenTimes>
<OpenTime ID="8" day="Monday" time="7:00-18:00" />
<OpenTime ID="9" day="Tuesday" time="7:00-18:00" />
<OpenTime ID="10" day="Wednesday" time="7:00-18:00" />
<OpenTime ID="11" day="Thursday" time="7:00-18:00" />
<OpenTime ID="12" day="Friday" time="7:00-18:00" />
</OpenTimes>
</PickupPoint>
<PickupPoint ID="5">
<Address>Laagna tee 187</Address>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
<OpenTime ID="6" day="Saturday" time="10:00-20:00" />
<OpenTime ID="7" day="Sunday" time="12:00-20:00" />
</OpenTimes>
</PickupPoint>
</PickupPoints>
</Bike>
<Bike Type="General Bike" Code="000004" Colour="Blue" Size="Medium" Name="aBike 003">
<PriceDay validFrom="2016-10-01">
<Amount>15</Amount>
<Currency>EUR</Currency>
</PriceDay>
<PriceHour validFrom="2016-10-01">
<Amount>3</Amount>
<Currency>EUR</Currency>
</PriceHour>
<Image><![CDATA[http://fcdn.mtbr.com/attachments/passion/690355d1334883662-sexiest-general-bike-part-20120105_164944.jpg]]></Image>
<AdditionalInfo>2015</AdditionalInfo>
<PickupPoints>
<PickupPoint ID="1">
<Address>Tallinn, Kopli 69n-2</Address>
<AdditionalInfo>Esimene korrus, nurga taga</AdditionalInfo>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
</OpenTimes>
</PickupPoint>
<PickupPoint ID="2">
<Address>Tartu mnt. 45</Address>
<OpenTimes>
<OpenTime ID="1" day="Monday" time="7:00-20:00" />
<OpenTime ID="2" day="Tuesday" time="7:00-20:00" />
<OpenTime ID="3" day="Wednesday" time="7:00-20:00" />
<OpenTime ID="4" day="Thursday" time="7:00-20:00" />
<OpenTime ID="5" day="Friday" time="7:00-20:00" />
<OpenTime ID="6" day="Saturday" time="10:00-20:00" />
<OpenTime ID="7" day="Sunday" time="12:00-20:00" />
</OpenTimes>
</PickupPoint>
</PickupPoints>
</Bike>
</Bikes>
</BikeRent>
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="BikeRent">
<xs:complexType>
<xs:sequence>
<xs:element name="Bikes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Bike">
<xs:complexType>
<xs:sequence>
<xs:element name="PriceDay">
<xs:complexType>
<xs:sequence>
<xs:element name="Amount" type="xs:unsignedByte" />
<xs:element name="Currency" type="xs:string" />
</xs:sequence>
<xs:attribute name="validFrom" type="xs:date" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="PriceHour">
<xs:complexType>
<xs:sequence>
<xs:element name="Amount" type="xs:unsignedByte" />
<xs:element name="Currency" type="xs:string" />
</xs:sequence>
<xs:attribute name="validFrom" type="xs:date" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Image" type="xs:string" />
<xs:element name="AdditionalInfo" type="xs:unsignedShort" />
<xs:element name="PickupPoints">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="PickupPoint">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element minOccurs="0" name="AdditionalInfo" type="xs:string" />
<xs:element name="OpenTimes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="OpenTime">
<xs:complexType>
<xs:attribute name="ID" type="xs:unsignedByte" use="required" />
<xs:attribute name="day" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ID" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Type" type="xs:string" use="required" />
<xs:attribute name="Code" type="xs:unsignedByte" use="required" />
<xs:attribute name="Colour" type="xs:string" use="required" />
<xs:attribute name="Size" type="xs:string" use="required" />
<xs:attribute name="Name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT -> HTML
<?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>Bikerent</title>
</head>
<body>
<table style="width:100%">
<tr>
<xsl:for-each select="BikeRent/Bikes/Bike">
<td style="width:25%">
<div>
<h3>
<xsl:value-of select="@Type"/>
</h3>
<p>
<xsl:value-of select="@Name"/>
</p>
<P>
<xsl:choose>
<xsl:when test="@Size = 'Small'">
<b>S</b>
</xsl:when>
<xsl:when test="@Size = 'Medium'">
<b>M</b>
</xsl:when>
<xsl:when test="@Size = 'Large'">
<b>L</b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</P>
<img src="{Image}" width="250" height="250"></img>
</div>
<div>
<table style="margin-top:30px; width:80%" border="1">
<tr>
<td>Price</td>
<td>
<div>
<xsl:value-of select="PriceDay/Amount"/>
<xsl:value-of select="PriceDay/Currency"/>
a day
</div>
<div>
<xsl:value-of select="PriceHour/Amount"/>
<xsl:value-of select="PriceHour/Currency"/>
an hour
</div>
</td>
</tr>
<tr style="height:30px">
<b>Available at:</b>
</tr>
<xsl:for-each select="PickupPoints/PickupPoint">
<tr>
<xsl:value-of select="Address"/>
</tr>
</xsl:for-each>
</table>
</div>
</td>
</xsl:for-each>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSLT -> XML
Näita jalgrattaid päevahinna järgi kasvavalt ning kohti; kui on pühapäeval lahti, näita aega.
<?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="/">
<xsl:element name="Bikes">
<xsl:for-each select="BikeRent/Bikes/Bike">
<xsl:sort select="PriceDay/Amount" order="ascending"/>
<Bike>
<xsl:attribute name="Name">
<xsl:value-of select="@Name"/>
</xsl:attribute>
<xsl:attribute name="Price">
<xsl:value-of select="PriceDay/Amount"/>
</xsl:attribute>
<xsl:for-each select="PickupPoints/PickupPoint">
<Location>
<xsl:attribute name="Address">
<xsl:value-of select="Address"/>
</xsl:attribute>
<xsl:for-each select="OpenTimes/OpenTime">
<xsl:if test="@day = 'Sunday'">
<Open>
<xsl:attribute name="Open">
<xsl:value-of select="@time"/>
</xsl:attribute>
</Open>
</xsl:if>
</xsl:for-each>
</Location>
</xsl:for-each>
</Bike>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Tulem:
<Bikes>
<Bike Name="aBike 003" Price="15">
<Location Address="Tallinn, Kopli 69n-2"/>
<Location Address="Tartu mnt. 45">
<Open Open="12:00-20:00"/>
</Location>
</Bike>
<Bike Name="FASTER_XS" Price="20">
<Location Address="Tallinn, Kopli 69n-2"/>
<Location Address="Tartu mnt. 45">
<Open Open="12:00-20:00"/>
</Location>
</Bike>
<Bike Name="MUCH MOUNTAIN" Price="23">
<Location Address="Tallinn, Kopli 69n-2"/>
</Bike>
<Bike Name="Dainty Lady 88" Price="25">
<Location Address="Tartu mnt. 45">
<Open Open="12:00-20:00"/>
</Location>
<Location Address="Pärnu mnt. 100"/>
<Location Address="Mäepealse 8"/>
<Location Address="Laagna tee 187">
<Open Open="12:00-20:00"/>
</Location>
</Bike>
</Bikes>
Veebiteenuse analüüs
Logi
21.04 - Projekti I osa valmimine