TahaksLopetada: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 111: | Line 111: | ||
</source> | </source> | ||
=== XSD | === XSD === | ||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> |
Revision as of 00:13, 6 May 2017
Kodutöö aines "Võrgurakendused II: hajussüsteemide ehitamine"
Meeskond
- Mart Naris
XML
<?xml version="1.0" encoding="utf-8"?>
<FootballClubs>
<FootballClub league="Premier League" country="England" networth="1500000000" currency="£">
<ClubName><![CDATA[Liverpool FC]]></ClubName>
<LogoUrl><![CDATA[http://www.lfchistory.net/Images/lfc/LIVE_5396.gif]]></LogoUrl>
<Owners>
<Owner ownershipType="share" ownershipPercentage="90">
<Name><![CDATA[Fenway Sports Group]]></Name>
</Owner>
<Owner ownershipType="share" ownershipPercentage="10">
<Name><![CDATA[Galway Sport]]></Name>
</Owner>
</Owners>
<Roster>
<Trainers>
<Trainer yearlySalary="7000000" currency="£" type="general manager">
<Name><![CDATA[Jürgen Klopp]]></Name>
</Trainer>
<Trainer yearlySalary="1000000" currency="£" type="assistant manager">
<Name><![CDATA[Željko Buvač]]></Name>
</Trainer>
</Trainers>
<Players>
<Player yearlySalary="3800000" currency="£" position="CM">
<Name><![CDATA[Jordan Henderson]]></Name>
</Player>
<Player yearlySalary="4000000" currency="£" position="FW">
<Name><![CDATA[Daniel Sturridge]]></Name>
</Player>
<Player yearlySalary="2000000" currency="£" position="GK">
<Name><![CDATA[Loris Karius]]></Name>
</Player>
</Players>
</Roster>
</FootballClub>
<FootballClub league="Serie A" country="Italy" networth="1100000000" currency="€">
<ClubName><![CDATA[Juventus FC]]></ClubName>
<LogoUrl><![CDATA[https://upload.wikimedia.org/wikipedia/en/thumb/d/d2/Juventus_Turin.svg/800px-Juventus_Turin.svg.png]]></LogoUrl>
<Owners>
<Owner ownershipType="share" ownershipPercentage="100">
<Name><![CDATA[EXOR N.V]]></Name>
</Owner>
</Owners>
<Roster>
<Trainers>
<Trainer yearlySalary="3500000" currency="€" type="general manager">
<Name><![CDATA[Massimiliano Allegri]]></Name>
</Trainer>
<Trainer yearlySalary="500000" currency="€" type="assistant manager">
<Name><![CDATA[Marco Landucci]]></Name>
</Trainer>
</Trainers>
<Players>
<Player yearlySalary="4500000" currency="€" position="CM">
<Name><![CDATA[Miralem Pjanić]]></Name>
</Player>
<Player yearlySalary="5500000" currency="€" position="FW">
<Name><![CDATA[Gonzalo Higuaín]]></Name>
</Player>
<Player yearlySalary="4000000" currency="€" position="GK">
<Name><![CDATA[Gianluigi Buffon]]></Name>
</Player>
</Players>
</Roster>
</FootballClub>
<FootballClub league="La Liga" country="Spain" networth="200000000" currency="€">
<ClubName><![CDATA[Club Atlético de Madrid]]></ClubName>
<LogoUrl><![CDATA[http://en.atleticodemadrid.com/img/atm_facebook.png]]></LogoUrl>
<Owners>
<Owner ownershipType="share" ownershipPercentage="50">
<Name><![CDATA[Miguel Ángel Gil Marín]]></Name>
</Owner>
<Owner ownershipType="share" ownershipPercentage="25">
<Name><![CDATA[Wanda Group]]></Name>
</Owner>
<Owner ownershipType="share" ownershipPercentage="25">
<Name><![CDATA[Enrique Cerezo]]></Name>
</Owner>
</Owners>
<Roster>
<Trainers>
<Trainer yearlySalary="5000000" currency="€" type="general manager">
<Name><![CDATA[Diego Simeone]]></Name>
</Trainer>
<Trainer yearlySalary="100000" currency="€" type="assistant manager">
<Name><![CDATA[Germán Adrián Ramón Burgos]]></Name>
</Trainer>
</Trainers>
<Players>
<Player yearlySalary="4000000" currency="€" position="CM">
<Name><![CDATA[Gabriel Fernández Arenas]]></Name>
</Player>
<Player yearlySalary="4000000" currency="€" position="FW">
<Name><![CDATA[Fernando Torres]]></Name>
</Player>
<Player yearlySalary="1300000" currency="€" position="GK">
<Name><![CDATA[Jan Oblak]]></Name>
</Player>
</Players>
</Roster>
</FootballClub>
</FootballClubs>
XSD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="percent">
<xs:annotation>
<xs:documentation>The percent type specifies a percentage from 0 to 100.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="FootballClubs">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="FootballClub">
<xs:complexType>
<xs:sequence>
<xs:element name="ClubName" type="xs:string" />
<xs:element name="LogoUrl" type="xs:string" />
<xs:element name="Owners">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Owner">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="ownershipType" type="xs:string" use="required" />
<xs:attribute name="ownershipPercentage" type="percent" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Roster">
<xs:complexType>
<xs:sequence>
<xs:element name="Trainers">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Trainer">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="yearlySalary" type="xs:decimal" use="optional" />
<xs:attribute name="currency" type="xs:string" use="optional" />
<xs:attribute name="type" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Players">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Player">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
<xs:attribute name="yearlySalary" type="xs:decimal" use="optional" />
<xs:attribute name="currency" type="xs:string" use="optional" />
<xs:attribute name="position" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="league" type="xs:string" use="required" />
<xs:attribute name="country" type="xs:string" use="required" />
<xs:attribute name="networth" type="xs:decimal" use="optional" />
<xs:attribute name="currency" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT
<?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></head>
<body>
<h1>Football Clubs</h1>
<table>
<xsl:for-each select="/FootballClubs/FootballClub">
<tr>
<td>
<h2>
<xsl:value-of select="ClubName" />
</h2>
<img style='float: left;'>
<xsl:attribute name="height">
200px
</xsl:attribute>
<xsl:attribute name="width">
150px
</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="LogoUrl" />
</xsl:attribute>
</img>
</td>
<td>
<h3>Trainers</h3>
<ul>
<xsl:for-each select="Roster/Trainers/Trainer">
<xsl:variable name="trainerType" select="./@type" />
<li>
<xsl:choose>
<xsl:when test="$trainerType = 'general manager'">
<strong><xsl:value-of select="Name" /></strong>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Name" />
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</td>
<td>
<h3>Players</h3>
<ul>
<xsl:for-each select="Roster/Players/Player">
<li>
<xsl:value-of select="Name" />
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>