Meeskond:vertigo: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Lkitsape (talk | contribs)
Lkitsape (talk | contribs)
Line 498: Line 498:
</xsl:stylesheet>
</xsl:stylesheet>
</pre>
</pre>
[[File:short.jpg|thumb|none]]
[[File:under.jpg|none]]
XML valitud andmetega, järjestatuna filmi tegemise aasta järgi.
XML valitud andmetega, järjestatuna filmi tegemise aasta järgi.
<pre>
<pre>

Revision as of 11:07, 7 March 2015

Liikmed

  1. Tanel Peet
  2. Meri-Kris Jaama
  3. Teele Liblik
  4. Kätlin Hein
  5. Liisi Kitsapea

XML andmefail

Link failidele

XML fail

<?xml version="1.0" encoding="utf-8" ?>
<movies>
  <movie id="1" year="2014">
    <title language="en"><![CDATA[Still Alice]]>
    </title>
    <genres>
      <genre>Drama</genre>
    </genres>
    <description><![CDATA[A linguistics professor and her family find their bonds tested when she is diagnosed with Early-onset Alzheimer's Disease.]]></description>
    <directors>
      <director><![CDATA[Richard Glatzer]]></director>
      <director>
        <![CDATA[Wash Westmoreland]]>
    </director>
    </directors>  
    <actors>
      <actor isLeadingRole="true"><![CDATA[Julianne Moore]]></actor>
      <actor isLeadingRole="true"><![CDATA[Alec Baldwin]]></actor>
      <actor isLeadingRole="true"><![CDATA[Kristen Stewart]]></actor>
      <actor isLeadingRole="false"><![CDATA[Daniel Gerroll]]></actor>
      <actor isLeadingRole="false"><![CDATA[Stephen Kunken]]></actor>
    </actors>
    <length unit="min">101</length>
    <release>
      <date>2015-02-22</date>
      <location>USA</location>
    </release>
    <productionCompanies>
      <company origin="fr"><![CDATA[BSM Studio]]></company>
      <company origin="us"><![CDATA[Big Indie Pictures]]></company>
      <company origin="us"><![CDATA[Killer Films]]></company>
      <company origin="us"><![CDATA[Shriver Films]]></company>
    </productionCompanies>
    <budget currency="USD">5000000</budget>
  </movie>
  <movie id="2" year="2013">
    <title language="et"><![CDATA[Mandariinid]]></title>
    <genres>
      <genre>Drama</genre>
      <genre>War</genre>
    </genres>
    <description><![CDATA[War in Georgia, Apkhazeti region in 1990. An Estonian man Ivo has stayed behind to harvest his crops of tangerines. In a bloody 
      conflict at his door, a wounded man is left behind, and Ivo is forced to take him in.]]></description>
    <directors>
      <director><![CDATA[Zaza Urushadze]]></director>
    </directors>
    <actors>
      <actor isLeadingRole="true"><![CDATA[Lembit Ulfsak]]></actor>
      <actor isLeadingRole="true"><![CDATA[Elmo Nüganen]]></actor>
      <actor isLeadingRole="true"><![CDATA[Giorgi Nakashidze]]></actor>
      <actor isLeadingRole="false"><![CDATA[Raivo Trass]]></actor>
    </actors>
    <length unit="min">87</length>
    <release>
      <date>2013-11-01</date>
      <location>Estonia</location>
    </release>
    <productionCompanies>
      <company origin="ee"><![CDATA[Allfilm]]></company>
      <company origin="ge"><![CDATA[Georgian Film]]></company>
    </productionCompanies>
    <budget currency="EUR">650000</budget>
  </movie>
  <movie id="3" year="2014">
      <title language="en"><![CDATA[The Imitation Game]]>
      </title>
      <genres>
          <genre>Drama</genre>
          <genre>Biography</genre>
          <genre>Thriller</genre>
      </genres>
      <description><![CDATA[During World War II, mathematician Alan Turing tries to crack the enigma code with help from fellow mathematicians.]]></description>
      <directors>
          <director><![CDATA[Morten Tyldum]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Benedict Cumberbatch]]></actor>
          <actor isLeadingRole="true"><![CDATA[Keira Knightley]]></actor>
          <actor isLeadingRole="true"><![CDATA[Matthew Goode]]></actor>
          <actor isLeadingRole="false"><![CDATA[Rory Kinnear]]></actor>
          <actor isLeadingRole="false"><![CDATA[Allen Leech]]></actor>
      </actors>
      <length unit="min">114</length>
      <release>
          <date>2014-12-25</date>
          <location>USA</location>
      </release>
      <productionCompanies>
          <company origin="us"><![CDATA[Black Bear Pictures]]></company>
          <company origin="us"><![CDATA[Bristol Automotive]]></company>
      </productionCompanies>
      <budget currency="USD">14000000</budget>
  </movie>
  <movie id="4" year="2014">
      <title language="en"><![CDATA[Birdman: Or (The Unexpected Virtue of Ignorance)]]>
      </title>
      <genres>
          <genre>Drama</genre>
          <genre>Comedy</genre>
      </genres>
      <description><![CDATA[A washed-up actor, who once played an iconic superhero, battles his ego and attempts to recover his 
       family, his career and himself in the days leading up to the opening of his Broadway play.]]></description>
      <directors>
          <director><![CDATA[Alejandro González Iñárritu]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Michael Keaton]]></actor>
          <actor isLeadingRole="true"><![CDATA[Zach Galifianakis]]></actor>
          <actor isLeadingRole="true"><![CDATA[Edward Norton]]></actor>
          <actor isLeadingRole="false"><![CDATA[Emma Stone]]></actor>
          <actor isLeadingRole="false"><![CDATA[Naomi Watts]]></actor>
      </actors>
      <length unit="min">119</length>
      <release>
          <date>2014-11-14</date>
          <location>USA</location>
      </release>
      <productionCompanies>
          <company origin="us"><![CDATA[New Regency Pictures]]></company>
          <company origin="us"><![CDATA[M Prods]]></company>
          <company origin="us"><![CDATA[Grisbi Productions, Le]]></company>
      </productionCompanies>
      <budget currency="USD">18000000</budget>
  </movie>
  <movie id="5" year="2014">
      <title language="en"><![CDATA[Boyhood]]>
      </title>
      <genres>
          <genre>Drama</genre>
      </genres>
      <description><![CDATA[The life of Mason, from early childhood to his arrival at college.]]></description>
      <directors>
          <director><![CDATA[Richard Linklater]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Ellar Coltrane]]></actor>
          <actor isLeadingRole="true"><![CDATA[Patricia Arquette]]></actor>
          <actor isLeadingRole="true"><![CDATA[Elijah Smith]]></actor>
          <actor isLeadingRole="false"><![CDATA[Lorelei Linklater]]></actor>
      </actors>
      <length unit="min">165</length>
      <release>
          <date>2014-08-15</date>
          <location>USA</location>
      </release>
      <productionCompanies>
          <company origin="us"><![CDATA[IFC Productions]]></company>
          <company origin="us"><![CDATA[Detour Filmproduction]]></company>
      </productionCompanies>
      <budget currency="USD">4000000</budget>
  </movie>
  <movie id="6" year="1994">
      <title language="en"><![CDATA[The Lion King]]>
      </title>
      <genres>
          <genre>Drama</genre>
          <genre>Animation</genre>
          <genre>Adventure</genre>
      </genres>
      <description><![CDATA[Lion cub and future king Simba tests his limits, supported by his family, but sometimes gets in over his head.]]></description>
      <directors>
          <director><![CDATA[Roger Allers]]></director>
          <director><![CDATA[Rob Minkoff]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Jonathan Taylor Thomas]]></actor>
          <actor isLeadingRole="true"><![CDATA[Matthew Broderick]]></actor>
          <actor isLeadingRole="true"><![CDATA[James Earl Jones]]></actor>
          <actor isLeadingRole="true"><![CDATA[Jeremy Irons]]></actor>
          <actor isLeadingRole="false"><![CDATA[Niketa Calame]]></actor>
      </actors>
      <length unit="min">89</length>
      <release>
          <date>1994-06-24</date>
          <location>USA</location>
      </release>
      <productionCompanies>
          <company origin="us"><![CDATA[Walt Disney Pictures]]></company>
          <company origin="us"><![CDATA[Walt Disney Feature Animation]]></company>
      </productionCompanies>
      <budget currency="USD">45000000</budget>
  </movie>
  <movie id="7" year="2014">
      <title language="fr"><![CDATA[Une nouvelle amie]]>
      </title>
      <genres>
          <genre>Drama</genre>
      </genres>
      <description><![CDATA[A young woman makes a surprising discovery about the husband of her late best friend.]]></description>
      <directors>
          <director><![CDATA[François Ozon]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Romain Duris]]></actor>
          <actor isLeadingRole="true"><![CDATA[Anaïs Demoustier]]></actor>
          <actor isLeadingRole="false"><![CDATA[Raphaël Personnaz]]></actor>
          <actor isLeadingRole="false"><![CDATA[Isild Le Besco]]></actor>
      </actors>
      <length unit="min">105</length>
      <release>
          <date>2014-09-06</date>
          <location>CAN</location>
      </release>
      <productionCompanies>
          <company origin="fr"><![CDATA[Mandarin Films]]></company>
          <company origin="fr"><![CDATA[FOZ]]></company>
          <company origin="fr"><![CDATA[Mars Films]]></company>
      </productionCompanies>
    <budget currency="EUR">2000000</budget>
  </movie>
  <movie id="8" year="2002">
      <title language="en"><![CDATA[Ice Age]]>
      </title>
      <genres>
          <genre>Comedy</genre>
          <genre>Animation</genre>
          <genre>Adventure</genre>
      </genres>
      <description><![CDATA[Set during the Ice Age, a sabertooth tiger, a sloth, and a wooly mammoth find a lost human infant, 
        and they try to return him to his tribe.]]></description>
      <directors>
          <director><![CDATA[Chris Wedge]]></director>
          <director><![CDATA[Carlos Saldanha]]></director>
      </directors>
      <actors>
          <actor isLeadingRole="true"><![CDATA[Ray Romano]]></actor>
          <actor isLeadingRole="true"><![CDATA[John Leguizamo]]></actor>
          <actor isLeadingRole="true"><![CDATA[Denis Leary]]></actor>
          <actor isLeadingRole="false"><![CDATA[Goran Visnjic]]></actor>
          <actor isLeadingRole="false"><![CDATA[Jack Black]]></actor>
      </actors>
      <length unit="min">81</length>
      <release>
          <date>2002-03-12</date>
          <location>USA</location>
      </release>
      <productionCompanies>
          <company origin="us"><![CDATA[Twentieth Century Fox Film Corporation]]></company>
          <company origin="us"><![CDATA[Blue Sky Studios]]></company>
          <company origin="us"><![CDATA[Twentieth Century Fox Animation]]></company>
      </productionCompanies>
      <budget currency="USD">59000000</budget>
  </movie>
</movies>

XML skeemifail

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:attribute name="origin">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:length value="2"></xs:length>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>

  <xs:attribute name="currency">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:length value="3"></xs:length>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  
  <xs:element name="movies">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="movie">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="title">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="language" type="xs:string" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="genres">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="5" name="genre" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="description" type="xs:string" />
              <xs:element name="directors">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="10" name="director" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="actors">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="actor">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="isLeadingRole" type="xs:boolean" use="optional" default="false" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="length">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:unsignedInt">
                      <xs:attribute name="unit" type="xs:string" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="release">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="date" type="xs:date" />
                    <xs:element name="location" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="productionCompanies">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="10" name="company">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute ref="origin" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="budget">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:unsignedInt">
                      <xs:attribute ref="currency" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:unsignedInt" use="required" />
            <xs:attribute name="year" type="xs:unsignedInt" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XML transformatsioonid

HTML, mis kuvab näitlejad filmide kaupa, eraldab peaosa- ja kõrvalosatäitjad.

<?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>
          <title>Movies</title>
        </head>
        <body>
          <h1>
            Actors of all good movies
          </h1>
          <xsl:for-each select="movies/movie">
            <hr/>
            <h2>
              <xsl:value-of select="title"/>
              <xsl:text> (</xsl:text>
              <xsl:value-of select="@year"/>
              <xsl:text>)</xsl:text>
            </h2>
            <h3>Actors</h3>
            <h4>Leading actors</h4>
            <ul>
              <xsl:for-each select="actors/actor">
                <xsl:if test="@isLeadingRole='true'">
                  <li>
                    <xsl:value-of select="."/>
                  </li>
                </xsl:if>
              </xsl:for-each>
            </ul>
            <h4>Actors</h4>
            <ul>
              <xsl:for-each select="actors/actor">
                <xsl:if test="@isLeadingRole='false'">
                  <li>
                    <xsl:value-of select="."/>
                  </li>
                </xsl:if>
              </xsl:for-each>
            </ul>
          </xsl:for-each>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

HTML, mis kuvab andmebaasis olevad filmid, mille pikkus on lühem kui 1,5 tundi.

<?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>
        <title>Short feature films</title>
      </head>
      <body>
        <h1>
          Movies which runtime is under 1.5 hours
        </h1>
        <xsl:for-each select="movies/movie">
          <xsl:if test="length < 90">
            <hr/>
            <h2>
              <xsl:value-of select="title"/>
              <xsl:text> (</xsl:text>
              <xsl:value-of select="@year"/>
              <xsl:text>)</xsl:text>
            </h2>
            <p>
              <xsl:for-each select="genres">
                <xsl:value-of select="genre"/>
              </xsl:for-each>
              <br/>
              <br/>
              <strong>Director(s): </strong>
              <xsl:text> </xsl:text>
              <xsl:for-each select="directors">
                <xsl:value-of select="director"/>
              </xsl:for-each>
              <br/>
              <strong>Length: </strong>
              <xsl:value-of select="length"/>
              <xsl:text> </xsl:text>
              <xsl:value-of select="length/@unit"/>
              <br/>
              <strong>Release date:  </strong>
              <xsl:value-of select="release/date"/>
              <br/>
              <strong>Budget:  </strong>
              <xsl:value-of select="budget"/>
              <xsl:text> </xsl:text>
              <xsl:value-of select="budget/@currency"/>
            </p>
            <p>
              <strong>Description:</strong>
              <xsl:text> </xsl:text>
              <xsl:value-of select="description"/>
            </p>
            <h3>Actors</h3>
            <ul>
              <xsl:for-each select="actors/actor">
                <li>
                  <xsl:value-of select="."/>
                </li>
              </xsl:for-each>
            </ul>
          </xsl:if>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

XML valitud andmetega, järjestatuna filmi tegemise aasta järgi.

<?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="xml" indent="yes"/>

  <xsl:template match="/">
    <movies>
      <xsl:for-each select="movies/movie">
        <xsl:sort select="@year"/>
        <movie>
          <xsl:copy-of select="title"/>
          <year>
            <xsl:value-of select="@year"/>
          </year>
          <xsl:copy-of select="directors"/>
          <xsl:copy-of select="description"/>
          <xsl:copy-of select="length"/>
          <xsl:copy-of select="genres"/>
        </movie>
      </xsl:for-each>
    </movies>
  </xsl:template>
</xsl:stylesheet>