JRT

From ICO wiki
Jump to navigationJump to search

Meeskond

Riho Uusjärv
Jevgeni Gavrilov
Tiit Kuuskmäe

Blog

03.19.2017 - Meeskonna loomine, teema välja mõtlemine, XML, XSD koostamine

Tööd

XML (pole veel valmis)

Teema

Spordisaalis on erinevad trennid, milles käivad erinevad isikud. XSLT jaoks siis teeme erinevad valitud filtreeringud

XML

<?xml version="1.0" encoding="utf-8" ?>
<users>
  <subscriptions>
    <subscrition><![CDATA[Balance]]>
      <prices>
        <price type="silver" currency="EUR">44.99</price>
        <price type="gold" currency="EUR">39.99</price>
        <price type="standard" currency="EUR">50.99</price>
      </prices>
    </subscrition>
    <subscrition><![CDATA[Gym]]>
      <prices>
        <price type="gold" currency="EUR">69.99</price>
        <price type="silver" currency="EUR">79.99</price>
        <price type="standard" currency="EUR">89.99</price>
      </prices>
    </subscrition>
    <subscrition><![CDATA[BodyPump]]>
      <prices>
        <price type="gold" currency="EUR">44.99</price>
        <price type="silver" currency="EUR">49.99</price>
        <price type="standard" currency="EUR">55.99</price>
      </prices>
    </subscrition>
    <subscrition><![CDATA[Yoga]]>
      <prices>
        <price type="gold" currency="EUR">39.99</price>
        <price type="silver" currency="EUR">42.99</price>
        <price type="standard" currency="EUR">45.99</price>
      </prices>
    </subscrition>
    <subscrition>
      <![CDATA[HotYoga]]>
      <prices>
        <price type="gold" currency="EUR">49.99</price>
        <price type="silver" currency="EUR">52.99</price>
        <price type="standard" currency="EUR">55.99</price>
      </prices>
    </subscrition>
  </subscriptions>
  <user id="1" status="gold">
    <firstName><![CDATA[Peeter]]></firstName>
    <lastName><![CDATA[Banaan]]></lastName>
    <born><![CDATA[11.12.2000]]></born>
    <sex><![CDATA[M]]></sex>
    <subscriptions>
      <subscription expires="2017-05-11"><![CDATA[Balance]]></subscription>
      <subscription expires="2017-08-26"><![CDATA[Gym]]></subscription>
      <subscription expires="2017-09-01"><![CDATA[Yoga]]></subscription>
    </subscriptions>
    <contacts>
      <contact type="phone"><![CDATA[55665566]]></contact>
      <contact type="email"><![CDATA[peeter@gmail.ee]]></contact>
      <contact type="skype"><![CDATA[PeeterB]]></contact>
    </contacts>
  </user>
  <user id="2" status="silver">
    <firstName><![CDATA[Merlin]]></firstName>
    <lastName><![CDATA[Kuusk]]></lastName>
    <born><![CDATA[11.07.1997]]></born>
    <sex><![CDATA[W]]></sex>
    <subscriptions>
      <subscription expires="2017-05-13"><![CDATA[BodyPump]]></subscription>
      <subscription expires="2017-09-11"><![CDATA[Balance]]></subscription>
    </subscriptions>
    <contacts>
      <contact type="phone"><![CDATA[5123123]]></contact>
    </contacts>
  </user>
  <user id="3" status="gold">
    <firstName><![CDATA[Maarika]]></firstName>
    <lastName><![CDATA[Tamm]]></lastName>
    <born><![CDATA[05.07.1999]]></born>
    <sex><![CDATA[W]]></sex>
    <subscriptions>
      <subscription expires="2017-08-11"><![CDATA[Yoga]]></subscription>
      <subscription expires="2017-11-23"><![CDATA[HotYoga]]></subscription>
    </subscriptions>
    <contacts>
      <contact type="email"><![CDATA[maarika@gmail.com]]></contact>
    </contacts>
  </user>
  <user id="4" status="gold">
    <firstName><![CDATA[Peeter]]></firstName>
    <lastName><![CDATA[Tamm]]></lastName>
    <born><![CDATA[22.03.2000]]></born>
    <sex><![CDATA[M]]></sex>
    <subscriptions>
      <subscription expires="2017-05-13"><![CDATA[BodyPump]]></subscription>
      <subscription expires="2017-05-13"><![CDATA[Gym]]></subscription>
    </subscriptions>
    <contacts>
      <contact type="phone"><![CDATA[55588899]]></contact>
      <contact type="email"><![CDATA[PeeterT@gmail.com]]></contact>
    </contacts>
  </user>
  <user id="5" status="silver">
    <firstName><![CDATA[Mihkel]]></firstName>
    <lastName><![CDATA[Koopov]]></lastName>
    <born><![CDATA[15.06.1994]]></born>
    <sex><![CDATA[M]]></sex>
    <contacts>
      <contact type="phone"><![CDATA[55588877]]></contact>
      <contact type="skype"><![CDATA[MKoopov]]></contact>
    </contacts>
  </user>
  <user id="6" status="standard">
    <firstName><![CDATA[Georg]]></firstName>
    <lastName><![CDATA[Karu]]></lastName>
    <born><![CDATA[03.03.1994]]></born>
    <sex><![CDATA[M]]></sex>
    <subscriptions>
      <subscription expires="2017-12-17"><![CDATA[Balance]]></subscription>
      <subscription expires="2017-09-01"><![CDATA[Gym]]></subscription>
    </subscriptions>
  </user>
  <user id="7" status="standard">
    <firstName><![CDATA[Liisa]]></firstName>
    <lastName><![CDATA[Leppmaa]]></lastName>
    <born><![CDATA[15.06.1991]]></born>
    <sex><![CDATA[W]]></sex>
    <subscriptions>
      <subscription expires="2017-09-11"><![CDATA[BodyPump]]></subscription>
      <subscription expires="2017-07-10"><![CDATA[HotYoga]]></subscription>
    </subscriptions>
    <contacts>
      <contact type="phone"><![CDATA[55512377]]></contact>
      <contact type="skype"><![CDATA[LLee]]></contact>
    </contacts>
  </user>
</users>

XML schema (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="users">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="subscriptions">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="subscription">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element name="prices">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="price">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:decimal">
                                  <xs:attribute name="type" type="xs:string" use="required" />
                                  <xs:attribute name="currency" type="xs:string" use="required" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" name="user">
          <xs:complexType>
            <xs:sequence>
              <xs:choice maxOccurs="unbounded">
                <xs:element name="firstName" type="xs:string" />
                <xs:element name="lastName" type="xs:string" />
                <xs:element name="born" type="xs:string" />
                <xs:element name="sex" type="xs:string" />
                <xs:element name="subscriptions">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element maxOccurs="unbounded" name="subscription">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="expires" type="xs:date" use="required" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element name="contacts">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element maxOccurs="unbounded" name="contact">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="type" type="xs:string" use="required" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="id" type="xs:int" use="required" />
            <xs:attribute name="status" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT 1


XSLT 2


Retsensioonid