Unnamed Team

From ICO wiki
Revision as of 18:04, 20 March 2017 by Akirotar (talk | contribs) (→‎XSD)
Jump to navigationJump to search

Meeskond

  • Andreas Kirotar
  • Jaan Kostõgov

Idee

XML ideeks on arvuti mängude kataloog.

XML / XSD / XSLT

<?xml version="1.0" encoding="UTF-8"?> <GameShop>

  <Genres>
     <Genre>Action</Genre>
     <Genre>RPG</Genre>
     <Genre>Action</Genre>
     <Genre>Fantasy</Genre>
     <Genre>Sci-fi</Genre>
     <Genre>Horror</Genre>
  </Genres>
  <Games>
     <Game Title="Fallout4" Year="2016">
        <Genres>
           <Genre>FPS</Genre>
           <Genre>Action</Genre>
           <Genre>Sci-fi</Genre>
        </Genres>
        <Images>
           <Image>http://cdn.akamai.steamstatic.com/steam/apps/377160/header.jpg?t=1486403180</Image>
           <Image>http://cdn.akamai.steamstatic.com/steam/apps/377160/header.jpg?t=1486403180</Image>
        </Images>
        <SystemRequiments RequimentType="Minimum">
           <Oses>
              <Os Architecture="64bit">Windows 7</Os>
              <Os Architecture="64bit">Windows 10</Os>
           </Oses>
           <Processor>Intel Core i5-2400/AMD FX-8320 or better</Processor>
           <Memory>4 GB RAM</Memory>
           <Graphics>NVIDIA GTX 670 2GB/AMD Radeon HD 7870 2GB or better</Graphics>
           <Storage>25 GB available space</Storage>
           <AdditionalNotes>Requires broadband internet connection for Multiplayer</AdditionalNotes>
        </SystemRequiments>
        <SystemRequiments RequimentType="Reccomended">
           <Os>Windows 7/8.1/10 (64-bit versions)</Os>
           <Processor>Intel Core i7-3770/AMD FX-8350 or better</Processor>
           <Memory>8 GB RAM</Memory>
           <Graphics>NVIDIA GTX 970 4GB/AMD Radeon R9 290 4GB or better</Graphics>
           <Storage>25 GB available space</Storage>
           <AdditionalNotes>Requires broadband internet connection for Multiplayer</AdditionalNotes>
        </SystemRequiments>
     </Game>
     <Game Title="Fallout 3 NewVegas" Year="2016">
        <Genres>
           <Genre>FPS</Genre>
           <Genre>Action</Genre>
           <Genre>Sci-fi</Genre>
        </Genres>
        <Images>
           <Image>https://i.kinja-img.com/gawker-media/image/upload/s--dWfA2BXt--/ilz6yicwfquqoyalkwjd.jpg</Image>
        </Images>
        <SystemRequiments RequimentType="Minimum">
           <Oses>
              <Os Architecture="32bit">Windows xp</Os>
              <Os Architecture="32bit">Windows Vista</Os>
           </Oses>
           <Processor>2.4 Ghz Intel Pentium 4 or equivalent processor</Processor>
           <Memory>1 GB (XP)/ 2 GB (Vista)</Memory>
           <Graphics>Direct X 9.0c compliant video card with 256MB RAM (NVIDIA 6800 or better/ATI X850 or better)</Graphics>
           <Storage>25 GB available space</Storage>
           <AdditionalNotes>Online play requires log-in to Games For Windows - Live</AdditionalNotes>
        </SystemRequiments>
     </Game>
     <Game Title="Dark Souls 3" Year="2016">
        <Genres>
           <Genre>RPG</Genre>
        </Genres>
        <Images>
           <Image>https://d1r7xvmnymv7kg.cloudfront.net/sites_products/darksouls3/assets/img/DARKSOUL_facebook_mini.jpg</Image>
           <Image>https://cdn2.vox-cdn.com/uploads/chorus_asset/file/6323691/Dark_Souls_3_concept_art.0.jpg</Image>
           <Image>https://i.ytimg.com/vi/Ha8eRiP0DmI/maxresdefault.jpg</Image>
        </Images>
        <SystemRequiments RequimentType="Minimum">
           <Oses>
              <Os Architecture="32bit">Windows xp</Os>
              <Os Architecture="32bit">Windows Vista</Os>
           </Oses>
           <Os>Windows 7 SP1 64bit, Windows 8.1 64bit Windows 10 64bit</Os>
           <Processor>Intel Core i3-2100 / AMD® FX-6300</Processor>
           <Memory>4 GB RAM</Memory>
           <Graphics>NVIDIA® GeForce GTX 750 Ti / ATI Radeon HD 7950</Graphics>
           <DirectX>Version 11</DirectX>
           <Network>Broadband Internet connection</Network>
           <Storage>25 GB available space</Storage>
           <SoundCard>DirectX 11 sound device</SoundCard>
        </SystemRequiments>
        <SystemRequiments RequimentType="Recommended">
           <Oses>
              <Os Architecture="64bit">Windows 7</Os>
              <Os Architecture="64bit">Windows 8.1</Os>
              <Os Architecture="64bit">Windows 10</Os>
           </Oses>
           <Processor>Intel Core i7-3770 / AMD® FX-8350</Processor>
           <Memory>8 GB RAM</Memory>
           <Graphics>NVIDIA® GeForce GTX 970 / ATI Radeon R9 series</Graphics>
           <DirectX>Version 11</DirectX>
           <Network>Broadband Internet connection</Network>
           <Storage>25 GB</Storage>
           <SoundCard>DirectX 11 sound device</SoundCard>
        </SystemRequiments>
     </Game>
  </Games>

</GameShop>


<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">

  <xs:element name="GameShop">
     <xs:complexType>
        <xs:sequence>
           <xs:element name="Genres">
              <xs:complexType>
                 <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="Genre" type="xs:string" />
                 </xs:sequence>
              </xs:complexType>
           </xs:element>
           <xs:element name="Games">
              <xs:complexType>
                 <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="Game">
                       <xs:complexType>
                          <xs:sequence>
                             <xs:element name="Genres">
                                <xs:complexType>
                                   <xs:sequence>
                                      <xs:element maxOccurs="unbounded" name="Genre" type="xs:string" />
                                   </xs:sequence>
                                </xs:complexType>
                             </xs:element>
                             <xs:element name="Images">
                                <xs:complexType>
                                   <xs:sequence>
                                      <xs:element maxOccurs="unbounded" name="Image" type="xs:string" />
                                   </xs:sequence>
                                </xs:complexType>
                             </xs:element>
                             <xs:element maxOccurs="unbounded" name="SystemRequiments">
                                <xs:complexType>
                                   <xs:sequence>
                                      <xs:choice maxOccurs="unbounded">
                                         <xs:element name="Os" type="xs:string" />
                                         <xs:element name="Oses">
                                            <xs:complexType>
                                               <xs:sequence>
                                                  <xs:element maxOccurs="unbounded" name="Os">
                                                     <xs:complexType>
                                                        <xs:simpleContent>
                                                           <xs:extension base="xs:string">
                                                              <xs:attribute name="Architecture" type="xs:string" use="required" />
                                                           </xs:extension>
                                                        </xs:simpleContent>
                                                     </xs:complexType>
                                                  </xs:element>
                                               </xs:sequence>
                                            </xs:complexType>
                                         </xs:element>
                                         <xs:element name="Processor" type="xs:string" />
                                         <xs:element name="Memory" type="xs:string" />
                                         <xs:element name="Graphics" type="xs:string" />
                                         <xs:element name="Storage" type="xs:string" />
                                         <xs:element name="AdditionalNotes" type="xs:string" />
                                         <xs:element name="DirectX" type="xs:string" />
                                         <xs:element name="Network" type="xs:string" />
                                         <xs:element name="SoundCard" type="xs:string" />
                                      </xs:choice>
                                   </xs:sequence>
                                   <xs:attribute name="RequimentType" type="xs:string" use="required" />
                                </xs:complexType>
                             </xs:element>
                          </xs:sequence>
                          <xs:attribute name="Title" type="xs:string" use="required" />
                          <xs:attribute name="Year" type="xs:unsignedShort" use="required" />
                       </xs:complexType>
                    </xs:element>
                 </xs:sequence>
              </xs:complexType>
           </xs:element>
        </xs:sequence>
     </xs:complexType>
  </xs:element>

</xs:schema>

XSLT

XSLT (HTML)

<?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>Games by genre(windows 7)</title>
     </head>
     <body>
       <xsl:for-each select="/GameShop/Genres/Genre">
         <xsl:variable name="MainGenre" select="."/>

<xsl:value-of select="$MainGenre"/>

    <xsl:for-each select="/GameShop/Games/Game"> <xsl:if test="(Genres/Genre = $MainGenre) and (SystemRequiments/Oses/Os ='Windows 7')"> <xsl:variable name="Game" select="."/>
  • Name: <xsl:value-of select="./@Title"/>
  • Release year: <xsl:value-of select="./@Year"/>
  • <xsl:for-each select="./Images/Image"> <xsl:variable name="ImageUrl" select="."/> <img src="{$ImageUrl}" width="400" height="200"/> </xsl:for-each>
  • Requirements:
  • Operating systems:<xsl:value-of select="$Game/SystemRequiments/Oses"/>
  • Processor:<xsl:value-of select="$Game/SystemRequiments/Processor"/>
  • Memory:<xsl:value-of select="$Game/SystemRequiments/Memory"/>
  • Graphics card:<xsl:value-of select="$Game/SystemRequiments/Graphics"/>
  • Storage:<xsl:value-of select="$Game/SystemRequiments/Storage"/>
  • Notes:<xsl:value-of select="$Game/SystemRequiments/AdditionalNotes"/>
  • Sound:<xsl:value-of select="$Game/SystemRequiments/SoundCard"/>
  • DirectX:<xsl:value-of select="$Game/SystemRequiments/DirectX"/>
  • </xsl:if> </xsl:for-each>
       </xsl:for-each>
     </body>
   </html>
 </xsl:template>

</xsl:stylesheet>

XSLT (XML)

Log

  • 17.03 Esimene kokkusaamine, XML, XSD, XSLT(HTML) kujul loomine.
  • 20.03 Kaugtööna XSLT(HTML) ja XSLT(XML) lõpetamine, Wiki lehe loomine.