Hubris

From ICO wiki
Revision as of 18:31, 6 March 2015 by Apaalo (talk | contribs)
Jump to navigationJump to search

Meeskond

  • Sander Maasikamäe
  • Allan Paalo
  • Madis Rääk

XML

Kirjeldus

placeholder

XML

<?xml version="1.0" encoding="utf-8" ?>

<adverts>
  <advert id="1" type="movie">
    <title><![CDATA[Lord of the Rings]]></title>
    <body><![CDATA[Description here]]></body>
    <date>06.03.2015</date>
    <likes>10000</likes>
    <dislikes>0</dislikes>
    <urls>
      <videourl><![CDATA[www.youtube.com]]></videourl>
      <weburl><![CDATA[www.lotr.com]]></weburl>
    </urls>
  </advert>

  <advert id="2" type="book">
    <title><![CDATA[Fight Club]]></title>
    <body><![CDATA[First rule of fight club is: You do not talk about fight club.]]></body>
    <date>02.03.2015</date>
    <likes>0</likes>
    <dislikes>0</dislikes>
    <urls>
      <videourl><![CDATA[www.youtube.com]]></videourl>
      <weburl><![CDATA[www.soap.com]]></weburl>
    </urls> 
  </advert>

  <advert id="3" type="music">
    <title><![CDATA[No Connection]]></title>
    <body><![CDATA[some band]]></body>
    <date>03.03.2015</date>
    <likes>10</likes>
    <dislikes>4</dislikes>
    <urls>
      <videourl><![CDATA[]]></videourl>
      <weburl><![CDATA[]]></weburl>
    </urls>
  </advert>

  <advert id="4" type="music">
    <title><![CDATA[Prince]]></title>
    <body><![CDATA[]]></body>
    <date>06.03.2015</date>
    <likes>6736</likes>
    <dislikes>3938</dislikes>
    <urls>
      <videourl><![CDATA[www.youtube.com]]></videourl>
      <weburl><![CDATA[]]></weburl>
    </urls>
  </advert>

  <advert id="5" type="book">
    <title><![CDATA[Fahrenheit 451]]></title>
    <body><![CDATA[Ray Bradbury]]></body>
    <date>05.03.2015</date>
    <likes>5739</likes>
    <dislikes>222</dislikes>
    <urls>
      <videourl><![CDATA[]]></videourl>
      <weburl><![CDATA[]]></weburl>
    </urls>
  </advert>
</adverts>

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="adverts">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="advert">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="title" type="xs:string" />
              <xs:element name="body" type="xs:string" />
              <xs:element name="date" type="xs:string" />
              <xs:element name="likes" type="xs:unsignedInt" />
              <xs:element name="dislikes" type="xs:unsignedInt" />
              <xs:element name="urls">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="videourl" type="xs:string" />
                    <xs:element name="weburl" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:unsignedInt" use="required" />
            <xs:attribute name="type" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT

Esimene - All Adverts

<?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>
          <table border="1">
            <tr>
              <th>Title</th>
              <th>Description</th>
              <th>Likes</th>
              <th>Dislikes</th>
            </tr>
            <xsl:for-each select="adverts/advert">
              <tr>
                <td>
                  <xsl:value-of select="title"/>
                </td>
                <td>
                  <xsl:value-of select="body"/>
                </td>
                <td>
                  <xsl:value-of select="likes"/>
                </td>
                <td>
                  <xsl:value-of select="dislikes"/>
                </td>
              </tr>
            </xsl:for-each>
          </table>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Väljund: http://enos.itcollege.ee/~apaalo/all.png

Teine - All Books

<?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>
          <table border="1">
            <tr>
              <th>Title</th>
              <th>Description</th>
              <th>Likes</th>
              <th>Dislikes</th>
            </tr>
            <xsl:for-each select="adverts/advert[@type='book']">
              <tr>
                <td>
                  <xsl:value-of select="title"/>
                </td>
                <td>
                  <xsl:value-of select="body"/>
                </td>
                <td>
                  <xsl:value-of select="likes"/>
                </td>
                <td>
                  <xsl:value-of select="dislikes"/>
                </td>
              </tr>
            </xsl:for-each>
          </table>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Väljund: http://enos.itcollege.ee/~apaalo/books.png

Kolmas - More than 100 likes

<?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>
        <table border="1">
          <tr>
            <th>Title</th>
            <th>Description</th>
            <th>Likes</th>
            <th>Dislikes</th>
          </tr>
          <xsl:for-each select="adverts/advert">
            <xsl:if test="likes &gt; 100">
              <tr>
                <td>
                  <xsl:value-of select="title"/>
                </td>
                <td>
                  <xsl:value-of select="body"/>
                </td>
                <td>
                  <xsl:value-of select="likes"/>
                </td>
                <td>
                  <xsl:value-of select="dislikes"/>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Väljund: http://enos.itcollege.ee/~apaalo/likes.png

Veebiteenus

Klientrakendus

Retsensioonid

Meeskonna tehtud retsensioonid

  • XML: placeholder
  • Veebiteenus: placeholder
  • Klientrakendused: placeholder

Meeskonnale tehtud retsensioonid

  • X: placeholder