Meeskond:ArturJaSobrad: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Atomba (talk | contribs)
Atomba (talk | contribs)
Line 1: Line 1:
==Meeskond==
'''Liikmed:''' Anni Klammer, Artur Tomba, Oliver Vahenõmm
==Meeskond==
==Meeskond==
'''Liikmed:''' Anni Klammer, Artur Tomba, Oliver Vahenõmm
'''Liikmed:''' Anni Klammer, Artur Tomba, Oliver Vahenõmm
Line 146: Line 149:
</xsl:stylesheet>
</xsl:stylesheet>
</source>
</source>
==Veebiteenus==
==Klientrakendused==

Revision as of 19:29, 6 March 2015

Meeskond

Liikmed: Anni Klammer, Artur Tomba, Oliver Vahenõmm

Meeskond

Liikmed: Anni Klammer, Artur Tomba, Oliver Vahenõmm

XML

XML

<?xml version="1.0" encoding="utf-8"?>
<Phonebook>
  <Groups>
    <Group name="Family">
      <Person id="1">
        <Firstname>Anna</Firstname>
        <Lastname>Nuga</Lastname>
        <Contacts>
          <Contact type="Phone">55555555</Contact>
          <Contact type="Skype">anna.nuga@skype.com</Contact>
        </Contacts>
      </Person>
      <Person id="2">
        <Firstname>Anti</Firstname>
        <Lastname>Nuga</Lastname>
        <Contacts>
          <Contact type="Phone">09876543</Contact>
          <Contact type="Skype">anti.nuga@skype.com</Contact>
        </Contacts>
      </Person>
      
    </Group>
    <Group name="Friends">
      <Person id="3">
        <Firstname>Minu</Firstname>
        <Lastname>Sober</Lastname>
        <Contacts>
          <Contact type="Phone">123456789</Contact>
          <Contact type="Skype">minu.sober@skype.com</Contact>
        </Contacts>
      </Person>
    </Group>
  </Groups>
</Phonebook>

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="Phonebook">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Groups">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="Group">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="Person">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Firstname" type="xs:string" />
                          <xs:element name="Lastname" type="xs:string" />
                          <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:sequence>
                        <xs:attribute name="id" type="xs:unsignedInt" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="name" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT

<?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>Phonebook</title>
        </head>
        <body>
          <xsl:for-each select="Phonebook/Groups/Group">
            <h3>
              <xsl:value-of select="@name"/>
            </h3>
            <table border="1" style="border:1px solid black;">
              <tr>
                <td>Firstname</td>
                <td>Lastname</td>
                <td>Phone</td>
                <td>Skype</td>
              </tr>
              <xsl:for-each select="Person">
                <tr>
                  <td>
                    <xsl:value-of select="Firstname"/>
                  </td>
                  <td>
                    <xsl:value-of select="Lastname"/>
                  </td>
                  <xsl:for-each select="Contacts/Contact">
                    <td>
                      <xsl:value-of select="."/>
                    </td>
                    
                  </xsl:for-each>
                </tr>
              </xsl:for-each>
              
              
            </table>
            <br/>
            
          </xsl:for-each>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Veebiteenus

Klientrakendused