Mjart: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Mhakkine (talk | contribs)
No edit summary
Mhakkine (talk | contribs)
No edit summary
Line 68: Line 68:
       <head></head>
       <head></head>
       <body>
       <body>
         <h1>Motor Vehicles</h1>
         <h1>Vehicles</h1>
         <ul>
         <ul>
           <xsl:for-each select="/Vehicles/Motorvehicles/Motorvehicle">
           <xsl:for-each select="/ArmedForces/Vehicles">
             <li>
             <h1>
               <h1>
               <xsl:value-of select="@type"/>
                Type of vehicle : <xsl:value-of select="@type"/>
            </h1>
              </h1>
            <xsl:for-each select="Vehicle">
              <h2>
            <h2>
                Name of vehicle : <xsl:value-of select="Name/."/>
              Type of vehicle : <xsl:value-of select="@type"/>
              </h2>
            </h2>
              <xsl:variable name="url" select="ImageUrl"/>
            <h3>
              <xsl:variable name="urlType" select="ImageUrl/@type"/>          
              Name of vehicle : <xsl:value-of select="Name/."/>
              <xsl:if test=" $urlType = 'absolute'">
            </h3>
                <img>
            <xsl:variable name="url" select="ImageUrl"/>
                  <xsl:attribute name="height">
            <xsl:variable name="urlType" select="ImageUrl/@type"/>
                    200px
            <xsl:if test=" $urlType = 'absolute'">
                  </xsl:attribute>
              <img>
                  <xsl:attribute name="src">
                <xsl:attribute name="height">
                    <xsl:value-of select="$url"/>
                  200px
                  </xsl:attribute>
                </xsl:attribute>
                </img>
                <xsl:attribute name="src">
               </xsl:if>
                  <xsl:value-of select="$url"/>
            </li>
                </xsl:attribute>
              </img>
            </xsl:if>
            <xsl:if test=" $urlType != 'absolute'">
               search for img in local dir
            </xsl:if>
          </xsl:for-each>
           </xsl:for-each>
           </xsl:for-each>
         </ul>
         </ul>

Revision as of 00:59, 21 March 2017

Tere, siia tuleb minu VRII Projekt

Tiimiliikmed : Märt Häkkinen

<?xml version="1.0" encoding="UTF-8"?>
<Vehicles>
  <Motorvehicles description="contains trucks,cars">
    <Motorvehicle id="1" type="multipurpose wheeled vehicle" cost="220000" currency="$" active="true">
      <Name><![CDATA[HMMWV M1025]]></Name>
      <Image_url type="absolute">
        <![CDATA[http://www.cgsociety.org/cgsarchive/newgallerycrits/g20/198120/198120_1269734620_large.jpg]]>
      </Image_url>
    </Motorvehicle>
    <Motorvehicle id="2" type="truck" cost="170000" currency="$" active="true">
      <Name><![CDATA[M939]]></Name>
      <Image_url 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]]>
      </Image_url>
    </Motorvehicle>
  </Motorvehicles>
  <Armoured_vehicles description="contains armoured vehicles, such as tanks, anti aircraft weapons systems, AFVs">
    <Armoured_vehicle id="3" type="tank" name="M1A2 ABRAMS" cost="6200000" currency="$" active="true">
      <Name><![CDATA[M1A1 ABRAMS]]></Name>
      <Image_url type="absolute">
        <![CDATA[http://www.military-today.com/tanks/m1a2_abrams.jpg]]>
      </Image_url>
    </Armoured_vehicle>
    <Armoured_vehicle id="4" type="armoured fighting vehicle" cost="4900000" currency="$" active="true">
      <Name><![CDATA[Stryker]]></Name>
      <Image_url type="absolute">
        <![CDATA[https://upload.wikimedia.org/wikipedia/commons/5/51/Stryker_ICV_front_q.jpg]]>
      </Image_url>
    </Armoured_vehicle>
    <Armoured_vehicle id="5" type="self-propelled anti-aircraft weapon system" cost="3500000" currency="$" active="false">
      <Name><![CDATA[M163 VADS]]></Name>
      <Image_url type="absolute">
        <![CDATA[http://afvdb.50megs.com/usa/pics/vadsside.jpg]]>
      </Image_url>
    </Armoured_vehicle>
  </Armoured_vehicles>
  <Watercrafts description="contains ships,boats and submarines">
    <Watercraft id="6" type="destroyer" cost="1200000000" currency="£" active="true">
      <Name><![CDATA[HMS Daring]]></Name>
      <Image_url 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]]>
      </Image_url>
    </Watercraft>
    <Watercraft id="7" type="submarine" cost="1000000000" currency="£" active="true">
      <Name><![CDATA[HMS Artful]]></Name>
      <Image_url type="absolute">
        <![CDATA[http://blogs.plymouth.ac.uk/dcss/wp-content/uploads/sites/50/2016/03/HMS-Artful-S121.jpg]]>
      </Image_url>
    </Watercraft>
  </Watercrafts>
</Vehicles>
</xs:schema>

<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>