Meeskond: QView
From ICO wiki
Meeskond
- Margus Muru
- Martin Nigul
- Martin Nõukas
- Semjon Greef
- Lisandra Noor
XML fail
<?xml version="1.0" encoding="utf-8"?>
<Cars>
<Bodies>
<Body Body-Id="1">
<Name>Sedan</Name>
</Body>
<Body Body-Id="2">
<Name>Coupe</Name>
</Body>
<Body Body-Id="3">
<Name>Hatchback</Name>
</Body>
<Body Body-Id="4">
<Name>Wagon</Name>
</Body>
<Body Body-Id="5">
<Name>Cabriolet</Name>
</Body>
<Body Body-Id="6">
<Name>SUV</Name>
</Body>
</Bodies>
<Fueltypes>
<Fueltype Fueltype-Id="1">
<Name>Petrol</Name>
</Fueltype>
<Fueltype Fueltype-Id="2">
<Name>Diesel</Name>
</Fueltype>
<Fueltype Fueltype-Id="3">
<Name>Electric</Name>
</Fueltype>
<Fueltype Fueltype-Id="4">
<Name>Hybrid</Name>
</Fueltype>
</Fueltypes>
<Brands>
<Make Make-Id="1">
<Name>Audi</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="2">
<Name>VolksWagen</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="3">
<Name>Volvo</Name>
<Country>Sweden</Country>
</Make>
<Make Make-Id="4">
<Name>BMW</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="5">
<Name>Mercedes-Benz</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="6">
<Name>Opel</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="7">
<Name>Lada</Name>
<Country>Russia</Country>
</Make>
<Make Make-Id="8">
<Name>Honda</Name>
<Country>Japan</Country>
</Make>
<Make Make-Id="9">
<Name>Toyota</Name>
<Country>Japan</Country>
</Make>
<Make Make-Id="10">
<Name>Nissan</Name>
<Country>Japan</Country>
</Make>
<Make Make-Id="11">
<Name>Skoda</Name>
<Country>Czech Republic</Country>
</Make>
<Make Make-Id="12">
<Name>Renault</Name>
<Country>France</Country>
</Make>
<Make Make-Id="13">
<Name>Caterham</Name>
<Country>United Kingdom</Country>
</Make>
<Make Make-Id="14">
<Name>Citroen</Name>
<Country>France</Country>
</Make>
<Make Make-Id="15">
<Name>Ariel</Name>
<Country>United States of America</Country>
</Make>
<Make Make-Id="16">
<Name>Seat</Name>
<Country>Spain</Country>
</Make>
<Make Make-Id="17">
<Name>Mazda</Name>
<Country>Japan</Country>
</Make>
<Make Make-Id="18">
<Name>Ford</Name>
<Country>Germany</Country>
</Make>
<Make Make-Id="19">
<Name>Suzuki</Name>
<Country>Japan</Country>
</Make>
<Make Make-Id="20">
<Name>Kia</Name>
<Country>South Korea</Country>
</Make>
<Make Make-Id="21">
<Name>Hyundai</Name>
<Country>South Korea</Country>
</Make>
<Make Make-Id="22">
<Name>Mini</Name>
<Country>United Kingdom</Country>
</Make>
</Brands>
<Transmissions>
<Transmission Trans-Id="1">
<Name>Automatic</Name>
</Transmission>
<Transmission Trans-Id="2">
<Name>Manual</Name>
</Transmission>
</Transmissions>
<Drivetrains>
<Drivetrain Drivetrain-Id="1">
<Name>Front-Wheel Drive</Name>
</Drivetrain>
<Drivetrain Drivetrain-Id="2">
<Name>Rear-Wheel Drive</Name>
</Drivetrain>
<Drivetrain Drivetrain-Id="3">
<Name>All-Wheel Drive</Name>
</Drivetrain>
</Drivetrains>
<Car Make-Id="1" Model="A6" Year="2010" RegPlate="123ABC" VIN="jasdfjasbdjf34234" Power="220kW" Milage="140000" Color="White" Price="25000">
<Comments>
Jumala katkine veermik
</Comments>
<Body Body-Id="1">
<Info> Suur ja pikk sedaan </Info>
</Body>
<Fueltypes Preferred="98" Fueltype-Id="1">
<FuelConsumption>8</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="3"/>
<Transmissions Trans-Id="1">
<Gears>7</Gears>
</Transmissions>
<ImageUrl>
http://o.aolcdn.com/dims-shared/dims3/GLOB/legacy_thumbnail/800x450/format/jpg/quality/85/http://o.aolcdn.com/hss/storage/midas/a899c65e2622bb49bc9c7d83c35fd097/201042411/2016-audi-a6-fd.jpg
</ImageUrl>
</Car>
<Car Make-Id="7" Model="Samara" Year="2000" RegPlate="315APV" VIN="jasjjhjdsfsbdjf34234" Power="82kW" Milage="250000" Color="Metallic-Green" Price="1800">
<Comments>
Kere roostetab
</Comments>
<Body Body-Id="3">
<Info>Kolme uksega</Info>
</Body>
<Fueltypes Preferred="95" Fueltype-Id="1">
<FuelConsumption>7</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="1" />
<Transmissions Trans-Id="2">
<Gears>5</Gears>
</Transmissions>
<ImageUrl>
http://img5.auto24.ee/auto24/320/032/44227032.jpg
</ImageUrl>
</Car>
<Car Make-Id="18" Model="Escort" Year="1998" RegPlate="125KJH" VIN="ja7878fsbdjf34234" Power="63kW" Milage="27000" Color="Red" Price="1100">
<Comments>
Ossipill
</Comments>
<Body Body-Id="1">
<Info>Natuke roostes, paar lohku keres.</Info>
</Body>
<Fueltypes Preferred="95" Fueltype-Id="1">
<FuelConsumption>11</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="1"/>
<Transmissions Trans-Id="2">
<Gears>5</Gears>
</Transmissions>
<ImageUrl>
https://i.ebayimg.com/00/s/NzY4WDEwMjQ=/z/vC0AAOSwTM5YxbNs/$_86.JPG
</ImageUrl>
</Car>
<Car Make-Id="4" Model="5-series" Year="2017" RegPlate="766BCH" VIN="wswa1238asd87123" Power="195kW" Milage="50" Color="Black" Price="77500">
<Comments>
Sõiduki asukoht: Saksamaa
Hind sisaldab transporti ja registreerimist Eestis.
</Comments>
<Body Body-Id="1">
<Info>Piklik sedaan.</Info>
</Body>
<Fueltypes Preferred="D" Fueltype-Id="2">
<FuelConsumption>6</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="3"/>"
<Transmissions Trans-Id="1">
<Gears>7</Gears>
</Transmissions>
<ImageUrl>
http://blog.caranddriver.com/wp-content/uploads/2016/10/2017-BMW-5-Series-101-876x535.jpg
</ImageUrl>
</Car>
<Car Make-Id="4" Model="3-series" Year="2002" RegPlate="172BCH" VIN="wswa1238hwhrd81233" Power="110kW" Milage="275000" Color="Silver" Price="3500">
<Comments>
Roostevaba
</Comments>
<Body Body-Id="1">
<Info>Kompaktne sedaan.</Info>
</Body>
<Fueltypes Preferred="D" Fueltype-Id="2">
<FuelConsumption>7</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="2"/>
<Transmissions Trans-Id="2">
<Gears>6</Gears>
</Transmissions>
<ImageUrl>
https://i.ytimg.com/vi/n5GAiugBWC8/maxresdefault.jpg
</ImageUrl>
</Car>
<Car Make-Id="5" Model="B-class" Year="2012" RegPlate="175JUS" VIN="wssd121338aswegrd855" Power="80kW" Milage="76000" Color="Grey" Price="19200">
<Comments>
Läbisõidugarantii
</Comments>
<Body Body-Id="3">
<Info>Hea pereauto</Info>
</Body>
<Fueltypes Preferred="D" Fueltype-Id="2">
<FuelConsumption>5</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="1"/>
<Transmissions Trans-Id="1">
<Gears>7</Gears>
</Transmissions>
<ImageUrl>
http://p.ocdn.ee/17/i/000259/x-855c414a-f493-451a-ba7a-4ed27f95bc77.jpg
</ImageUrl>
</Car>
<Car Make-Id="10" Model="Skyline R34 GTT" Year="1999" RegPlate="SNR442" VIN="wsbd9514753jvseiga751" Power="212kW" Milage="76500" Color="Blue" Price="29500">
<Comments>
UK rooliga auto.
</Comments>
<Body Body-Id="2">
<Info>Megakiire masin.</Info>
</Body>
<Fueltypes Preferred="98" Fueltype-Id="1">
<FuelConsumption>15</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="2"/>
<Transmissions Trans-Id="2">
<Gears>6</Gears>
</Transmissions>
<ImageUrl>
https://s-media-cache-ak0.pinimg.com/originals/8d/e6/b2/8de6b2a55873b2044480921b83ba928f.jpg
</ImageUrl>
</Car>
<Car Make-Id="22" Model="Cooper" Year="2003" RegPlate="SN34PE" VIN="WMWRC31010TH01840" Power="85kW" Milage="233788" Color="Red" Price="3400">
<Comments>
Esiklaasis on mõrad.
</Comments>
<Body Body-Id="3">
<Info>Armas autoke.</Info>
</Body>
<Fueltypes Preferred="95" Fueltype-Id="1">
<FuelConsumption>9</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="1"/>
<Transmissions Trans-Id="1">
<Gears>6</Gears>
</Transmissions>
<ImageUrl>
http://global.fncstatic.com/static/managed/img/Leisure/2009/mini-cooper-2014.jpg
</ImageUrl>
</Car>
<Car Make-Id="2" Model="Beetle" Year="1998" RegPlate="4AUW407" VIN="WVWZZZ16ZEM635903" Power="72kW" Milage="278000" Color="Red" Price="1700">
<Comments>
Auto regulaarselt hooldatud.
</Comments>
<Body Body-Id="3">
<Info>Kolme uksega</Info>
</Body>
<Fueltypes Preferred="D" Fueltype-Id="2">
<FuelConsumption>6</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="1"/>
<Transmissions Trans-Id="2">
<Gears>5</Gears>
</Transmissions>
<ImageUrl>
http://i.imgur.com/iS6OjqD.jpg
</ImageUrl>
</Car>
<Car Make-Id="9" Model="Supra" Year="1998" RegPlate="69SUPRA" VIN="WW23283WJDZUIE238" Power="300kW" Milage="68000" Color="Silver" Price="62000">
<Comments>
Haruludane, vähe sõitnud eksemplar.
</Comments>
<Body Body-Id="2">
<Info>Kolme uksega</Info>
</Body>
<Fueltypes Preferred="98" Fueltype-Id="1">
<FuelConsumption>10</FuelConsumption>
</Fueltypes>
<Drivetrain Drivetrain-Id="2" />
<Transmissions Trans-Id="2">
<Gears>6</Gears>
</Transmissions>
<ImageUrl>
https://static.cargurus.com/images/site/2012/02/27/06/02/1998_toyota_supra-pic-5576793256549915341-1600x1200.jpeg
</ImageUrl>
</Car>
</Cars>
XSLT XML
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>
<body>
<h1>Car Database</h1>
<xsl:for-each select="/Cars/Car">
<xsl:variable name="M-Id" select="@Make-Id" />
<h2>
<xsl:value-of select="/Cars/Brands/Make[@Make-Id=$M-Id]/Name"/>
</h2>
<br>
Model:
<xsl:value-of select="@Model"/>
</br>
<br>
Country:
<xsl:value-of select="/Cars/Brands/Make[@Make-Id=$M-Id]/Country"/>
</br>
<br>
Year:
<xsl:value-of select="@Year"/>
</br>
<br>
RegPlate:
<xsl:value-of select="@RegPlate"/>
</br>
<br>
VIN:
<xsl:value-of select="@VIN"/>
</br>
<br>
Power:
<xsl:value-of select="@Power"/>
</br>
<br>
Milage:
<xsl:value-of select="@Milage"/>
</br>
<br>
Color:
<xsl:value-of select="@Color"/>
</br>
<br>
Price:
<xsl:value-of select="@Price"/>
</br>
<br>
<xsl:for-each select="Comments">
Comment:
<xsl:value-of select="."/>
</xsl:for-each>
</br>
<br>
Body:
<xsl:variable name="B-Id" select="Body/@Body-Id" />
<xsl:value-of select="/Cars/Bodies/Body[@Body-Id=$B-Id]/Name"/>
, Comments:
<xsl:for-each select="Body/Info">
<xsl:value-of select="."/>
</xsl:for-each>
</br>
<br>
Fuel type:
<xsl:variable name="F-Id" select="Fueltypes/@Fueltype-Id" />
<xsl:value-of select="/Cars/Fueltypes/Fueltype[@Fueltype-Id=$F-Id]/Name"/>
</br>
<br>
Fuel consumption:
<xsl:for-each select="Fueltypes/FuelConsumption">
<xsl:value-of select="."/>
</xsl:for-each>
l/100km
</br>
<br>
Drivetrain:
<xsl:variable name="D-Id" select="Drivetrain/@Drivetrain-Id" />
<xsl:value-of select="/Cars/Drivetrains/Drivetrain[@Drivetrain-Id=$D-Id]/Name"/>
</br>
<br>
Gearbox:
<xsl:variable name="T-Id" select="Transmissions/@Trans-Id" />
<xsl:value-of select="/Cars/Transmissions/Transmission[@Trans-Id=$T-Id]/Name"/>
, number of gears:
<xsl:for-each select="Transmissions/Gears">
<xsl:value-of select="."/>
</xsl:for-each>
</br>
<br>
<xsl:for-each select="ImageUrl">
<xsl:variable name="ImageUrl" select="."/>
<img style="width: 30em" src="{$ImageUrl}"/>
</xsl:for-each>
</br>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
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="Cars">
<xs:complexType>
<xs:sequence>
<xs:element name="Bodies">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Body">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="Body-Id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Fueltypes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Fueltype">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="Fueltype-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Brands">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Make">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Country" type="xs:string" />
</xs:sequence>
<xs:attribute name="Make-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Transmissions">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Transmission">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="Trans-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Drivetrains">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Drivetrain">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="Drivetrain-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="Car">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="Comments" type="xs:string" />
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element name="Info" type="xs:string" />
</xs:sequence>
<xs:attribute name="Body-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Fueltypes">
<xs:complexType>
<xs:sequence>
<xs:element name="FuelConsumption" type="xs:unsignedByte" />
</xs:sequence>
<xs:attribute name="Preferred" type="xs:string" use="optional" />
<xs:attribute name="Fueltype-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Drivetrain">
<xs:complexType>
<xs:attribute name="Drivetrain-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Transmissions">
<xs:complexType>
<xs:sequence>
<xs:element name="Gears" type="xs:unsignedByte" />
</xs:sequence>
<xs:attribute name="Trans-Id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="ImageUrl" type="xs:string" />
</xs:sequence>
<xs:attribute name="Make-Id" type="xs:unsignedInt" use="required" />
<xs:attribute name="Model" type="xs:string" use="required" />
<xs:attribute name="Year" type="xs:unsignedInt" use="required" />
<xs:attribute name="RegPlate" type="xs:string" use="optional" />
<xs:attribute name="VIN" type="xs:string" use="optional" />
<xs:attribute name="Power" type="xs:string" use="optional" />
<xs:attribute name="Milage" type="xs:unsignedInt" use="required" />
<xs:attribute name="Color" type="xs:string" use="optional" />
<xs:attribute name="Price" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>