Meeskond "Kujuneb": Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 60: | Line 60: | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<xs:element name=" | <xs:element name="tootekataloog"> | ||
<xs:complexType> | <xs:complexType> | ||
<xs:sequence> | <xs:sequence> | ||
<xs:element | <xs:element name="zanrid"> | ||
<xs:complexType> | <xs:complexType> | ||
<xs:sequence> | <xs:sequence> | ||
<xs:element name=" | <xs:element maxOccurs="unbounded" name="zanr"> | ||
<xs:element name=" | <xs:complexType> | ||
<xs:element name=" | <xs:sequence> | ||
<xs:element name="nimi" type="xs:string" /> | |||
</xs:sequence> | |||
<xs:attribute name="id" type="xs:unsignedByte" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="artistid"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="artist"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="nimi" type="xs:string" /> | |||
</xs:sequence> | |||
<xs:attribute name="id" type="xs:unsignedByte" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="albumid"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="album"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="zanr" type="xs:unsignedByte" /> | |||
<xs:element name="artist" type="xs:unsignedByte" /> | |||
<xs:element name="nimi" type="xs:string" /> | |||
<xs:element name="aasta" type="xs:unsignedShort" /> | |||
<xs:element name="lugusi" type="xs:unsignedByte" /> | |||
<xs:element name="pilt" type="xs:string" /> | |||
<xs:element name="hind" type="xs:decimal" /> | |||
</xs:sequence> | |||
<xs:attribute name="id" type="xs:unsignedByte" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | </xs:sequence> | ||
</xs:complexType> | </xs:complexType> | ||
</xs:element> | </xs:element> | ||
Line 81: | Line 116: | ||
</xs:schema> | </xs:schema> | ||
</source> | </source> | ||
=== Stiilifail (XSLT) === | === Stiilifail (XSLT) === |
Revision as of 14:00, 1 May 2011
Liikmed
- Rauno Väli
- Andreas Lea
- Erik Peinar
XML
Andmefail (XML)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- <?xml-stylesheet type="text/xsl" href="style.xslt"?> -->
<tootekataloog>
<!-- zanride loetelu-->
<zanrid>
<zanr id="1">
<nimi>Pop</nimi>
</zanr>
<zanr id="2">
<nimi>Rap</nimi>
</zanr>
</zanrid>
<!-- artistide loetelu-->
<artistid>
<artist id="1">
<nimi>Queen</nimi>
</artist>
<artist id="2">
<nimi>Madonna</nimi>
</artist>
</artistid>
<!-- albumite loetelu-->
<albumid>
<album id="1">
<zanr>1</zanr>
<artist>1</artist>
<nimi>Greatest Hits</nimi>
<aasta>2005</aasta>
<lugusi>15</lugusi>
<pilt>http://bit.ly/jreygb</pilt>
<hind>12</hind>
</album>
<album id="2">
<zanr>2</zanr>
<artist>2</artist>
<nimi>American Life</nimi>
<aasta>2002</aasta>
<lugusi>19</lugusi>
<pilt>http://bit.ly/jwEHdl</pilt>
<hind>8.3</hind>
</album>
</albumid>
</tootekataloog>
Skeemifail (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="tootekataloog">
<xs:complexType>
<xs:sequence>
<xs:element name="zanrid">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="zanr">
<xs:complexType>
<xs:sequence>
<xs:element name="nimi" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="artistid">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="artist">
<xs:complexType>
<xs:sequence>
<xs:element name="nimi" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="albumid">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="album">
<xs:complexType>
<xs:sequence>
<xs:element name="zanr" type="xs:unsignedByte" />
<xs:element name="artist" type="xs:unsignedByte" />
<xs:element name="nimi" type="xs:string" />
<xs:element name="aasta" type="xs:unsignedShort" />
<xs:element name="lugusi" type="xs:unsignedByte" />
<xs:element name="pilt" type="xs:string" />
<xs:element name="hind" type="xs:decimal" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Stiilifail (XSLT)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Muusikakogu</title>
<style type="text/css">
body {
font-family: Arial, Verdana;
}
table {
font-size: 12px;
border-collapse: collapse;
}
.mainTable {
border: 1px solid #98bf21;
}
.mainTable th {
padding: 3px 10px 3px 10px;
border: 1px solid #98bf21;
background-color: #A7C942;
color: #FFFFFF;
}
.mainTable tr {
background-color: #FFFFFF;
}
.mainTable td {
text-align: center;
padding: 3px;
border: 1px solid #98bf21;
}
a, a:hover, a:active, a:visited {
color: #000000;
}
a img {
border: none;
}
</style>
</head>
<body>
<h1>Albumid</h1>
<table class="mainTable">
<tr>
<th>Artist</th>
<th>Plaat</th>
<th>Aasta</th>
<th>Genre</th>
<th>Laule</th>
<th>Pilt</th>
<th>YouTube</th>
</tr>
<xsl:for-each select="albumid/album">
<tr>
<xsl:if test="position() mod 2 =0">
<xsl:attribute name="style">
background-color: #EAF2D3;
</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="artist"/>
</td>
<td>
<xsl:value-of select="plaat"/>
</td>
<td>
<xsl:value-of select="aasta"/>
</td>
<td>
<xsl:value-of select="genre"/>
</td>
<td>
<xsl:value-of select="songs"/>
</td>
<td>
<img width="100" height="100">
<xsl:attribute name="src">
<xsl:value-of select="pilt"/>
</xsl:attribute>
</img>
</td>
<td>
<a>
<xsl:attribute name="href">
<xsl:text>http://www.youtube.com/results?search_query=</xsl:text><xsl:value-of select="artist"/>+<xsl:value-of select="plaat"/>
</xsl:attribute>
<img src="http://www.upload.ee/image/1288041/youtube-badge-64x64.png">
</img>
</a>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>