Meeskond "Kujuneb": Difference between revisions
From ICO wiki
Jump to navigationJump to search
→XML: Panin kindluse mõttes viite stylesheetile ka sisse (välja commentituna). Ühtlasi queeni image loadis üli aeglaselt, vahetasin kiirema ja pisema vastu :) |
Muutsin pisut lehe liigendatust. Lisasin liikmete nimistu. |
||
Line 1: | Line 1: | ||
===XML | == Liikmed == | ||
* Rauno Väli | |||
* Andreas Lea | |||
* Erik Peinar | |||
== XML == | |||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Line 23: | Line 29: | ||
</source> | </source> | ||
== XSD == | |||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Line 49: | Line 56: | ||
</source> | </source> | ||
== XSLT == | |||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Line 154: | Line 162: | ||
</xsl:template> | </xsl:template> | ||
</xsl:stylesheet> | </xsl:stylesheet> | ||
</source> | |||
== | === Brauseri vaade === | ||
[[File:Muusikakogu_naidis.png]] | [[File:Muusikakogu_naidis.png]] |
Revision as of 20:02, 21 April 2011
Liikmed
- Rauno Väli
- Andreas Lea
- Erik Peinar
XML
<?xml version="1.0" encoding="utf-8"?>
<!-- <?xml-stylesheet type="text/xsl" href="style.xslt"?> -->
<albumid>
<album id="1">
<artist>Queen</artist>
<plaat>Greatest Hits</plaat>
<aasta>2005</aasta>
<genre>Pop</genre>
<songs>15</songs>
<pilt>http://di1-1.shoppingshadow.com/images/pi/7a/f1/43/2002025795-149x149-0-0_Greatest_Hits_Hollywood_Queen.jpg</pilt>
</album>
<album id="2">
<artist>Madonna</artist>
<plaat>American Life</plaat>
<aasta>2002</aasta>
<genre>Rap</genre>
<songs>19</songs>
<pilt>http://www.clubbingmagazine.com/images/reviews/madonna%20single.jpg</pilt>
</album>
</albumid>
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="albumid">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="album">
<xs:complexType>
<xs:sequence>
<xs:element name="artist" type="xs:string" />
<xs:element name="plaat" type="xs:string" />
<xs:element name="aasta" type="xs:unsignedShort" />
<xs:element name="genre" type="xs:string" />
<xs:element name="songs" type="xs:unsignedByte" />
<xs:element name="pilt" 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:schema>
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>