CSharpArt: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Line 8: Line 8:
<source lang=xml>
<source lang=xml>
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="stiil1.xslt" ?>
<?xml-stylesheet type="text/xsl" href="stiil2.xslt" ?>


<phoneBook>
<phoneBook>
Line 27: Line 27:
         <street>Narva mnt.</street>
         <street>Narva mnt.</street>
         <house>5</house>
         <house>5</house>
         <appartement>13</appartement>
         <apartment>13</apartment>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>
Line 36: Line 36:
         <street>Pärnu mnt.</street>
         <street>Pärnu mnt.</street>
         <house>25</house>
         <house>25</house>
         <appartement/>
         <apartment/>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>
Line 85: Line 85:
         <street>Narva mnt.</street>
         <street>Narva mnt.</street>
         <house>5</house>
         <house>5</house>
         <appartement>13</appartement>
         <apartment>13</apartment>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>
Line 92: Line 92:
         <county>Harjumaa</county>
         <county>Harjumaa</county>
         <city>Tallinn</city>
         <city>Tallinn</city>
         <street>Pärnu mnt.</street>
         <street>Pärnu mnt.</street>Š
         <house>25</house>
         <house>25</house>
         <appartement/>
         <apartment/>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>
Line 144: Line 144:
         <street>Pärnu mnt.</street>
         <street>Pärnu mnt.</street>
         <house>253b</house>
         <house>253b</house>
         <appartement/>
         <apartment/>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>
Line 192: Line 192:
         <street>Pärnu mnt.</street>
         <street>Pärnu mnt.</street>
         <house>253b</house>
         <house>253b</house>
         <appartement/>
         <apartment/>
         <zipCode>12345</zipCode>
         <zipCode>12345</zipCode>
       </address>
       </address>

Revision as of 10:38, 25 March 2013

Meeskond

  • Kristo Roosileht (D22)
  • Mihkel Kadarik (D22)
  • Henri Kroosmann (D61)
  • Ats Rand (D22)

XML fail

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="stiil2.xslt" ?>

<phoneBook>
  <phoneBookItem type="person" id="1">
    <personName>
      <givenNames>
        <name default="1">Paul</name>
        <name>Peeter</name>
      </givenNames>
      <familyName>Puujalg</familyName>
    </personName>
    <birthday format="YYYY-MM-DD">1919-02-27</birthday>
    <addresses>
      <address id="1" default="1">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Narva mnt.</street>
        <house>5</house>
        <apartment>13</apartment>
        <zipCode>12345</zipCode>
      </address>
      <address id="2">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Pärnu mnt.</street>
        <house>25</house>
        <apartment/>
        <zipCode>12345</zipCode>
      </address>
    </addresses>
    <contactInfo>
      <phones>
        <phone type="home" areaCode="372">63440292</phone>
        <phone type="mobile" areaCode="372" default="1">55566334</phone>
        <phone type="work" areaCode="372">555234231</phone>
        <phone type="skype" areaCode="372">2340240</phone>
      </phones>
      <emails>
        <email type="personal" default="1">mail@mail.ee</email>
        <email type="work">mail@puujalg.ee</email>
      </emails>
      <other>
        <skype>paul.peeter.puujalg</skype>
        <twitter>paulpeeterpuujalg</twitter>
      </other>
    </contactInfo>
    <additionalInfo>
      <websites>
       <website type="facebook">http://www.facebook.com/paulpeeterpuujalg</website>
      </websites>
      <company id="4">
        <name>Puujalad &amp; Co.</name>
      </company>
      <notes>
        <note date="2013-02-10">Tegemist töökaaslasega minu eelmisest ettevõttest</note>
      </notes>
    </additionalInfo>
  </phoneBookItem>

  <phoneBookItem type="person" id="2">
    <personName>
      <givenNames>
        <name default="1">Karl</name>
        <name>Kristjan</name>
      </givenNames>
      <familyName>Konkskäsi</familyName>
    </personName>
    <birthday format="YYYY-MM-DD">1919-02-27</birthday>
    <addresses>
      <address id="1" default="1">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Narva mnt.</street>
        <house>5</house>
        <apartment>13</apartment>
        <zipCode>12345</zipCode>
      </address>
      <address id="2">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Pärnu mnt.</street>Š
        <house>25</house>
        <apartment/>
        <zipCode>12345</zipCode>
      </address>
    </addresses>
    <contactInfo>
      <phones>
        <phone type="home" areaCode="372">63440292</phone>
        <phone type="mobile" areaCode="372" default="1">55566334</phone>
        <phone type="work" areaCode="372">555234231</phone>
        <phone type="skype" areaCode="372">2340240</phone>
      </phones>
      <emails>
        <email type="personal" default="1">mail@mail.ee</email>
        <email type="work">mail@konksk2si.ee</email>
      </emails>
      <other>
        <skype>karl.kristjan.konksk2si</skype>
        <twitter>karlkristjankonksk2si</twitter>
      </other>
    </contactInfo>
    <additionalInfo>
      <websites>
        <website type="facebook">http://www.facebook.com/karlkristjankonksk2si</website>
      </websites>
      <company id="3">
        <name>Konkskäed &amp; Co.</name>
      </company>
      <notes>
        <note date="2013-02-10">Tegemist töökaaslasega minu järgmisest ettevõttest</note>
      </notes>
    </additionalInfo>
  </phoneBookItem>
  
  <phoneBookItem type="organization" id="3">
    <orgName>Konkskäed &amp; Co.</orgName>
    <addresses>
      <address id="45" default="1" type="office">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Tartu mnt.</street>
        <house>45</house>
        <zipCode>12345</zipCode>
      </address>
      <address id="2" type="shop">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Pärnu mnt.</street>
        <house>253b</house>
        <apartment/>
        <zipCode>12345</zipCode>
      </address>
    </addresses>
    <contactInfo>
      <phones>
        <phone areaCode="372" default="1">6310456</phone>
      </phones>
      <emails>
        <email default="1">kiri@konksk2si.ee</email>
      </emails>
      <other>
        <skype>konksk2si.klienditeenindus</skype>
        <test>testkontakt</test>
      </other>
    </contactInfo>
    <additionalInfo>
      <websites>
        <website type="homepage">http://www.konksk2si.ee</website>
        <website type="shop">http://pood.konksk2si.ee</website>
        <website type="facebook">http://www.facebook.com/konksk2si</website>
      </websites>
      <notes>
        <note date="2012-12-12">See on koht, kust saab väga häid konkse kätele</note>
      </notes>
      <contactPersons>
        <person id="2">Karl Kristjan Konkskäsi</person>
      </contactPersons>
    </additionalInfo>
  </phoneBookItem>

  <phoneBookItem type="organization" id="4">
    <orgName>Puujalad &amp; Co.</orgName>
    <addresses>
      <address id="45" default="1" type="office">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Tartu mnt.</street>
        <house>45</house>
        <zipCode>12345</zipCode>
      </address>
      <address id="2" type="shop">
        <country>Estonia</country>
        <county>Harjumaa</county>
        <city>Tallinn</city>
        <street>Pärnu mnt.</street>
        <house>253b</house>
        <apartment/>
        <zipCode>12345</zipCode>
      </address>
    </addresses>
    <contactInfo>
      <phones>
        <phone areaCode="372" default="1">6310456</phone>
      </phones>
      <emails>
        <email default="1">kiri@puujalad.ee</email>
      </emails>
      <other>
        <skype>puujalad.klienditeenindus</skype>
        <twitter>puujalad</twitter>
      </other>
    </contactInfo>
    <additionalInfo>
      <websites>
        <website type="homepage">http://www.puujalad.ee</website>
        <website type="shop">http://pood.puujalad.ee</website>
      </websites>
      <notes>
        <note date="2012-12-12">See on koht, kust saab väga häid puujalgu</note>
      </notes>
      <contactPersons>
        <person id="1">Paul Peeter Puujalg</person>
      </contactPersons>
    </additionalInfo>
  </phoneBookItem>
</phoneBook>

Stiilifail1

Stiilifail, mis väljastab kõik isikud.

<?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:template match="/">
      <html>
        <body bgcolor="#eeeeee">
          <h2>Kontakt! Isikud</h2>
          <table border="1">
            <tr bgcolor="#9acd32">
                <th>Sünnipäev</th>
                <th>Eesnimi</th>
                <th>Perekonnanimi</th>
                <th>Aadress</th>
                <th>Telefon</th>
                <th>e-Mail</th>
                <th>Muu</th>
                <th>Veebilehed</th>
              </tr>
          <xsl:for-each select="phoneBook/phoneBookItem">
            <xsl:if test="@type = 'person'">
              <tr>
                <td>
                  <xsl:value-of select="birthday"/>
                </td>

                <td>
                    <xsl:for-each select="personName/givenNames/name"><xsl:value-of select="." /><xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text></xsl:for-each>
                </td>

                <td>
                    <xsl:value-of select="personName/familyName" />
                </td>

                <td>
                    <table>
                    <xsl:for-each select="addresses/address">
                        <tr>
                            <td>
                                <xsl:value-of select="country" /><br />
                                <xsl:value-of select="county" /><br />
                                <xsl:value-of select="city" />,<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select="zipCode" /><br />
                                <xsl:value-of select="street" /><xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select="house" />
                                <xsl:if test="./apartment/text()">
                                    <xsl:text disable-output-escaping="yes"><![CDATA[&dash;]]></xsl:text><xsl:value-of select="apartment" />
                                </xsl:if>
                            </td>
                        </tr>
                    </xsl:for-each>
                    </table>
                </td>

                <td>
                    <table>
                      <xsl:for-each select ="contactInfo/phones/phone">
                        <tr>
                            <td><xsl:value-of select="./@type"/>:<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select ="."/></td>
                        </tr>
                      </xsl:for-each>
                    </table>
                </td>

                <td>
                    <table>
                        <xsl:for-each select="contactInfo/emails/email">
                            <tr>
                                <td><xsl:value-of select="./@type" />:<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select="." /></td>
                            </tr>
                        </xsl:for-each>
                    </table>
                </td>

                <td>
                    <table>
                        <xsl:for-each select="contactInfo/other">
                            <tr>
                                <td>
                                    <table>
                                        <xsl:if test="skype">
                                            <tr>
                                                <td>Skype:<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select="skype" /></td>
                                            </tr>
                                        </xsl:if>
                                        <xsl:if test="test">
                                            <tr>
                                                <td>Test:<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><xsl:value-of select="test" /></td>
                                            </tr>
                                        </xsl:if>
                                    </table>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </table>
                </td>

                <td>
                    <table>
                        <xsl:for-each select="additionalInfo/websites/website">
                            <tr>
                                <td><xsl:value-of select="./@type" />:<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text><br /><xsl:value-of select="." /></td>
                            </tr>
                        </xsl:for-each>
                    </table>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
          </table>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Stiilifail2

Stiilifail, mis väljastab kõi ettevõtted.

<?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:template match="/">
        <html>
            <body bgcolor="#eeeeee">
              <h2>Kontakt! - Ettevõtted</h2>
              <table border="1">
                  <tr bgcolor="#9acd32">
                    <th>Nimi</th>
                    <th>Aadressid</th>
                    <th>Telefonid</th>
                    <th>e-Mailid</th>
                    <th>Muu kontaktinfo</th>
                    <th>Veebilehed</th>
                    <th>Kontaktisikud</th>
                  </tr>
                <xsl:for-each select="phoneBook/phoneBookItem">
                    <xsl:if test="@type = 'organization'">
                        <tr>
                            <td><xsl:value-of select="orgName"/></td>
                            <td>
                                <table>
                                <xsl:for-each select="addresses/address">
                                    <tr>
                                        <td>
                                            <xsl:value-of select="country" /><br />
                                            <xsl:value-of select="county" /><br />
                                            <xsl:value-of select="city" />, <xsl:value-of select="zipCode" /><br />
                                            <xsl:value-of select="street" /> <xsl:value-of select="house" /> <xsl:value-of select="appartement" />
                                        </td>
                                    </tr>
                                </xsl:for-each>
                                </table>
                            </td>
                            <td>
                                <table>
                                    <xsl:for-each select="contactInfo/phones">
                                        <tr>
                                            <td><xsl:value-of select="phone/@type"/>: +<xsl:value-of select="phone/@areaCode" /><xsl:value-of select="phone" /></td>
                                        </tr>
                                    </xsl:for-each>
                                </table>
                            </td>
                            <td>
                                <table>
                                    <xsl:for-each select="contactInfo/emails/email">
                                        <tr>
                                            <td><xsl:value-of select="." /></td>
                                        </tr>
                                    </xsl:for-each>
                                </table>
                            </td>
                            <td>
                                <table>
                                    <xsl:for-each select="contactInfo/other">
                                        <tr>
                                            <td>
                                                <table>
                                                    <xsl:if test="skype">
                                                        <tr>
                                                            <td>Skype: <xsl:value-of select="skype" /></td>
                                                        </tr>
                                                    </xsl:if>
                                                    <xsl:if test="test">
                                                        <tr>
                                                            <td>Test: <xsl:value-of select="test" /></td>
                                                        </tr>
                                                    </xsl:if>
                                                </table>
                                            </td>
                                        </tr>
                                    </xsl:for-each>
                                </table>
                            </td>
                            <td>
                                <table>
                                    <xsl:for-each select="additionalInfo/websites/website">
                                        <tr>
                                            <td><xsl:value-of select="./@type" />: <br /><xsl:value-of select="." /></td>
                                        </tr>
                                    </xsl:for-each>
                                </table>
                            </td>
                            <td>
                                <table>
                                    <xsl:for-each select="additionalInfo/contactPersons/person">
                                        <tr>
                                            <td>(<xsl:value-of select="./@id" />) <xsl:value-of select="." /></td>
                                        </tr>
                                    </xsl:for-each>
                                </table>
                            </td>
                        </tr>
                    </xsl:if>
                </xsl:for-each>
              </table>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

Skeemifail

<?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 maxOccurs="unbounded" name="phoneBookItem">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" name="orgName" type="xs:string" />
              <xs:element minOccurs="0" name="personName">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="givenNames">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="name">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="default" type="xs:unsignedByte" use="optional" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="familyName" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="birthday">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:date">
                      <xs:attribute name="format" type="xs:string" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="addresses">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="address">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" name="address">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="country" type="xs:string" />
                                <xs:element name="county" type="xs:string" />
                                <xs:element name="city" type="xs:string" />
                                <xs:element name="street" type="xs:string" />
                                <xs:element name="house" type="xs:string" />
                                <xs:element name="appartement" />
                                <xs:element name="zipCode" type="xs:unsignedShort" />
                              </xs:sequence>
                              <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" name="country" type="xs:string" />
                          <xs:element minOccurs="0" name="county" type="xs:string" />
                          <xs:element minOccurs="0" name="city" type="xs:string" />
                          <xs:element minOccurs="0" name="street" type="xs:string" />
                          <xs:element minOccurs="0" name="house" type="xs:unsignedByte" />
                          <xs:element minOccurs="0" name="appartement" type="xs:unsignedByte" />
                          <xs:element minOccurs="0" name="zipCode" type="xs:unsignedShort" />
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                        <xs:attribute name="default" type="xs:unsignedByte" use="optional" />
                        <xs:attribute name="type" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="contactInfo">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="phones">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="phone">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:unsignedInt">
                                  <xs:attribute name="type" type="xs:string" use="optional" />
                                  <xs:attribute name="areaCode" type="xs:unsignedShort" use="required" />
                                  <xs:attribute name="default" type="xs:unsignedByte" use="optional" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="emails">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="email">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="type" type="xs:string" use="optional" />
                                  <xs:attribute name="default" type="xs:unsignedByte" use="optional" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="other">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="skype" type="xs:string" />
                          <xs:element minOccurs="0" name="twitter" type="xs:string" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="additionalInfo">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="websites">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="website">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="type" type="xs:string" use="optional" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="company">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="name" type="xs:string" />
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="notes">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="note">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="date" type="xs:date" use="required" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="contactPersons">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="person">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="id" type="xs:unsignedByte" 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:attribute name="type" type="xs:string" use="required" />
            <xs:attribute name="id" type="xs:unsignedByte" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Logi

19.03.2013 11:30 - Moodustasime Tiimi

19.03.2013 15:00 - Alustasime Wiki lehega

23.03.2013 23:58 - Esitatsime XML kodutöö