PageNotFound: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Apaomees (talk | contribs)
Apaomees (talk | contribs)
Line 285: Line 285:




==XSLT: Broneeringute Sõitukite id-de kuvamine==
==XSLT: Broneeringute sõitukite margi ja mudeli kuvamine==


<source lang="xml">
<source lang="xml">
Line 307: Line 307:
               <ul>
               <ul>
                 <li>
                 <li>
                   <xsl:text>Sõiduki ID: </xsl:text>
                   <xsl:variable name="vehicleId" select="vehicleId"/>
                   <xsl:value-of select="vehicleId" />
                  <xsl:text>Sõiduk: </xsl:text>
                  <xsl:value-of select="../../../../vehicles/vehicle[@id = $vehicleId]/make" />
                  <xsl:text> </xsl:text>
                   <xsl:value-of select="../../../../vehicles/vehicle[@id = $vehicleId]/model" />
                 </li>
                 </li>
               </ul>
               </ul>
Line 322: Line 325:


Tulemus: [http://enos.itcollege.ee/~apaomees/VR2/XSLTFile2.htm Broneeringute Sõitukite id-de kuvamine]
Tulemus: [http://enos.itcollege.ee/~apaomees/VR2/XSLTFile2.htm Broneeringute Sõitukite id-de kuvamine]


==XSLT: Sõidukite andmete kuvamine==
==XSLT: Sõidukite andmete kuvamine==

Revision as of 15:31, 1 May 2017

Meeskond

  • Arvo Paomees


XML

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

 <rent>
  <bookings>
    <booking id="1" hidden="false">
      <bookedVehicles>
        <bookedVehicle id="1">
          <vehicleId>2</vehicleId>
        </bookedVehicle>
        <bookedVehicle id="2">
          <vehicleId>1</vehicleId>
        </bookedVehicle>
        <bookedVehicle id="3">
          <vehicleId>3</vehicleId>
        </bookedVehicle>
      </bookedVehicles>
      <data>
        <userId>2</userId>
        <startTime>02.05.2017 13:00:22</startTime>
        <endTime>05.05.2017 13:00:22</endTime>
        <additionalDriver>false</additionalDriver>
        <gps>true</gps>
        <childCarSeats>false</childCarSeats>
        <youngDriver>true</youngDriver>
      </data>
    </booking>
    <booking id="2" hidden="false">
      <bookedVehicles>
        <bookedVehicle id="1">
          <vehicleId>3</vehicleId>
        </bookedVehicle>
        <bookedVehicle id="2">
          <vehicleId>1</vehicleId>
        </bookedVehicle>
      </bookedVehicles>
      <data>
        <userId>1</userId>
        <startTime>05.05.2017 13:00:22</startTime>
        <endTime>06.05.2017 13:00:22</endTime>
        <additionalDriver>false</additionalDriver>
        <gps>false</gps>
        <childCarSeats>true</childCarSeats>
        <youngDriver>true</youngDriver>
      </data>
    </booking>
    <booking id="3" hidden="false">
      <bookedVehicles>
        <bookedVehicle id="1">
          <vehicleId>3</vehicleId>
        </bookedVehicle>
      </bookedVehicles>
      <data>
        <userId>2</userId>
        <startTime>08.05.2017 13:00:22</startTime>
        <endTime>11.05.2017 13:00:22</endTime>
        <additionalDriver>false</additionalDriver>
        <gps>true</gps>
        <childCarSeats>false</childCarSeats>
        <youngDriver>true</youngDriver>
      </data>
    </booking>
  </bookings>
  <users>
    <user id="1" type="admin">
      <username><![CDATA[admin]]></username>
      <password><![CDATA[admin123]]></password>
      <firstname><![CDATA[Peeter]]></firstname>
      <lastname><![CDATA[Pakiraam]]></lastname>
      <title><![CDATA[Härra]]></title>
      <mail><![CDATA[peeter@Pakiraam.ee]]></mail>
      <phone><![CDATA[+3725556515]]></phone>
      <created>01.05.2017 13:00:22</created>
      <hidden>false</hidden>
    </user>
    <user id="2" type="user">
      <username><![CDATA[juku]]></username>
      <password><![CDATA[juku123]]></password>
      <firstname><![CDATA[Juhan]]></firstname>
      <lastname><![CDATA[Tamm]]></lastname>
      <title><![CDATA[Härra]]></title>
      <mail><![CDATA[juku@tamm.ee]]></mail>
      <phone><![CDATA[+3725542515]]></phone>
      <created>01.05.2017 13:00:22</created>
      <hidden>false</hidden>
    </user>
    <user id="3" type="user">
      <username><![CDATA[mati]]></username>
      <password><![CDATA[mati123]]></password>
      <firstname><![CDATA[Mati]]></firstname>
      <lastname><![CDATA[Kuusk]]></lastname>
      <title><![CDATA[Härra]]></title>
      <mail><![CDATA[mati@neti.ee]]></mail>
      <phone><![CDATA[+37255444515]]></phone>
      <created>01.05.2017 13:00:22</created>
      <hidden>false</hidden>
    </user>
  </users>
  <vehicles>
    <vehicle id="1">
      <make><![CDATA[Audi]]></make>
      <model><![CDATA[A6]]></model>
      <year>2016</year>
      <price>50</price>
      <hidden>false</hidden>
    </vehicle>
    <vehicle id="2">
      <make><![CDATA[Skoda]]></make>
      <model><![CDATA[Octavia]]></model>
      <year>2017</year>
      <price>40</price>
      <hidden>false</hidden>
    </vehicle>
    <vehicle id="3">
      <make><![CDATA[Volkswagen]]></make>
      <model><![CDATA[Passat]]></model>
      <year>2017</year>
      <price>45</price>
      <hidden>false</hidden>
    </vehicle>
  </vehicles>
</rent>


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="rent">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="bookings">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="booking">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="bookedVehicles">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="bookedVehicle">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="vehicleId" type="xs:unsignedInt" />
                              </xs:sequence>
                              <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="data">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="userId" type="xs:unsignedInt" />
                          <xs:element name="startTime" type="xs:string" />
                          <xs:element name="endTime" type="xs:string" />
                          <xs:element name="additionalDriver" type="xs:boolean" />
                          <xs:element name="gps" type="xs:boolean" />
                          <xs:element name="childCarSeats" type="xs:boolean" />
                          <xs:element name="youngDriver" type="xs:boolean" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:unsignedInt" use="required" />
                  <xs:attribute name="hidden" type="xs:boolean" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="users">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="user">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="username" type="xs:string" />
                    <xs:element name="password" type="xs:string" />
                    <xs:element name="firstname" type="xs:string" />
                    <xs:element name="lastname" type="xs:string" />
                    <xs:element name="title" type="xs:string" />
                    <xs:element name="mail" type="xs:string" />
                    <xs:element name="phone" type="xs:string" />
                    <xs:element name="created" type="xs:string" />
                    <xs:element name="hidden" type="xs:boolean" />
                  </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:element name="vehicles">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="vehicle">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="make" type="xs:string" />
                    <xs:element name="model" type="xs:string" />
                    <xs:element name="year" type="xs:unsignedInt" />
                    <xs:element name="price" type="xs:unsignedInt" />
                    <xs:element name="hidden" type="xs:boolean" />
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:unsignedInt" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


XSLT: Tavakasutajate kontaktandmete kuvamine

<?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>
        <xsl:for-each select="rent/users/user">
          <xsl:if test="@type = 'user'">
            <h2>
              <xsl:value-of select="title" />
              <xsl:text>: </xsl:text>
              <xsl:value-of select="firstname" />
              <xsl:text> </xsl:text>
              <xsl:value-of select="lastname" />
            </h2>
            <table border="1">
                <tr>
                  <th>Kasutajanimi</th>
                  <th>
                    <xsl:value-of select="username" />
                  </th>
                </tr>
                <tr>
                  <th>E-mail</th>
                  <th>
                    <xsl:value-of select="mail" />
                  </th>
                </tr>
                <tr>
                  <th>Telefon</th>
                  <th>
                    <xsl:value-of select="phone" />
                  </th>
                </tr>
            </table>
          </xsl:if>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Tulemus: Tavakasutajate kontaktandmete kuvamine


XSLT: Broneeringute sõitukite margi ja mudeli kuvamine

<?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>
        <xsl:for-each select="rent/bookings/booking">
          <xsl:if test="@hidden = 'false'">
            <h2>
              <xsl:text>Broneeringu ID: </xsl:text>
              <xsl:value-of select="@id" />
            </h2>
            <xsl:for-each select="bookedVehicles/bookedVehicle">
              <ul>
                <li>
                  <xsl:variable name="vehicleId" select="vehicleId"/>
                  <xsl:text>Sõiduk: </xsl:text>
                  <xsl:value-of select="../../../../vehicles/vehicle[@id = $vehicleId]/make" />
                  <xsl:text> </xsl:text>
                  <xsl:value-of select="../../../../vehicles/vehicle[@id = $vehicleId]/model" />
                </li>
              </ul>
            </xsl:for-each>
          </xsl:if>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Tulemus: Broneeringute Sõitukite id-de kuvamine

XSLT: Sõidukite andmete kuvamine

<?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>
        <xsl:for-each select="rent/vehicles/vehicle">
          <xsl:if test="hidden = 'false'">
            <h2>
              <xsl:text>Sõiduki ID: </xsl:text>
              <xsl:value-of select="@id" />
            </h2>
            <table border="1">
              <tr>
                <th>Mark</th>
                <th>
                  <xsl:value-of select="make" />
                </th>
              </tr>
              <tr>
                <th>Mudel</th>
                <th>
                  <xsl:value-of select="model" />
                </th>
              </tr>
              <tr>
                <th>Aasta</th>
                <th>
                  <xsl:value-of select="year" />
                </th>
              </tr>
              <tr>
                <th>Hind</th>
                <th>
                  <xsl:value-of select="price" />
                  €/h
                </th>
              </tr>
            </table>
          </xsl:if>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Tulemus: Sõidukite andmete kuvamine