Mjart

From ICO wiki
Revision as of 00:59, 21 March 2017 by Mhakkine (talk | contribs)
Jump to navigationJump to search

Tere, siia tuleb minu VRII Projekt

Tiimiliikmed : Märt Häkkinen

<?xml version="1.0" encoding="utf-8" ?>
<ArmedForces>
  <Vehicles type="MotorVehicles" name="Motor Vehicles" description="contains trucks,cars">
    <Vehicle id="1" type="multipurpose wheeled vehicle" cost="220000" currency="$" active="true">
      <Name><![CDATA[HMMWV M1025]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[http://www.cgsociety.org/cgsarchive/newgallerycrits/g20/198120/198120_1269734620_large.jpg]]>
      </ImageUrl>
    </Vehicle>
    <Vehicle id="2" type="truck" cost="170000" currency="$" active="true">
      <Name><![CDATA[M939]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[https://upload.wikimedia.org/wikipedia/commons/6/67/US_Marine_Corps_030224-M-XT622-034_USMC_M923_(6X6)_5-ton_cargo_truck_heads_a_convoy_departing_Camp_Matilda,_Kuwait_crop.jpg]]>
      </ImageUrl>
    </Vehicle>
  </Vehicles>
  <Vehicles type="Armoured" name="Armoured Vehicles" description="contains armoured vehicles, such as tanks, anti aircraft weapons systems, AFVs">
    <Vehicle id="3" type="tank" name="M1A2 ABRAMS" cost="6200000" currency="$" active="true">
      <Name><![CDATA[M1A1 ABRAMS]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[http://www.military-today.com/tanks/m1a2_abrams.jpg]]>
      </ImageUrl>
    </Vehicle>
    <Vehicle id="4" type="armoured fighting vehicle" cost="4900000" currency="$" active="true">
      <Name><![CDATA[Stryker]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[https://upload.wikimedia.org/wikipedia/commons/5/51/Stryker_ICV_front_q.jpg]]>
      </ImageUrl>
    </Vehicle>
    <Vehicle id="5" type="self-propelled anti-aircraft weapon system" cost="3500000" currency="$" active="false">
      <Name><![CDATA[M163 VADS]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[http://afvdb.50megs.com/usa/pics/vadsside.jpg]]>
      </ImageUrl>
    </Vehicle>
  </Vehicles>
  <Vehicles type="Watercraft" name="Watercrafts" description="contains ships,boats and submarines">
    <Vehicle id="6" type="destroyer" cost="1200000000" currency="£" active="true">
      <Name><![CDATA[HMS Daring]]></Name>
      <ImageUrl type="relative">
        <![CDATA[/commons/thumb/c/c9/Royal_Navy_Type_45_Destroyer_HMS_Daring_MOD_45153705.jpg/1280px-Royal_Navy_Type_45_Destroyer_HMS_Daring_MOD_45153705.jpg]]>
      </ImageUrl>
    </Vehicle>
    <Vehicle id="7" type="submarine" cost="1000000000" currency="£" active="true">
      <Name><![CDATA[HMS Artful]]></Name>
      <ImageUrl type="absolute">
        <![CDATA[http://blogs.plymouth.ac.uk/dcss/wp-content/uploads/sites/50/2016/03/HMS-Artful-S121.jpg]]>
      </ImageUrl>
    </Vehicle>
  </Vehicles>
</ArmedForces>

<source lang="xml"> <?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></head>
     <body>

Vehicles

    <xsl:for-each select="/ArmedForces/Vehicles">

    <xsl:value-of select="@type"/>

               <xsl:for-each select="Vehicle">
    

    Type of vehicle : <xsl:value-of select="@type"/>

    Name of vehicle : <xsl:value-of select="Name/."/>

               <xsl:variable name="url" select="ImageUrl"/>
               <xsl:variable name="urlType" select="ImageUrl/@type"/>
               <xsl:if test=" $urlType = 'absolute'">
                 <img>
                   <xsl:attribute name="height">
                     200px
                   </xsl:attribute>
                   <xsl:attribute name="src">
                     <xsl:value-of select="$url"/>
                   </xsl:attribute>
                 </img>
               </xsl:if>
               <xsl:if test=" $urlType != 'absolute'">
                 search for img in local dir
               </xsl:if>
             </xsl:for-each>
             </xsl:for-each>
    
     </body>
   </html>
 </xsl:template>

</xsl:stylesheet>