Vaht

From ICO wiki
Revision as of 00:16, 18 June 2013 by Vavaht (talk | contribs) (Created page with '===Koosseis=== * Valdar Vaht ==XML== ===XML Ülesanne=== Proovisin teha lihtsa nimekirja õpilastest ja nende deklareeritud ainetest <source lang=xml> <?xml version="1.0" encod…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Koosseis

  • Valdar Vaht

XML

XML Ülesanne

Proovisin teha lihtsa nimekirja õpilastest ja nende deklareeritud ainetest

<?xml version="1.0" encoding="utf-8" ?>
<students>
  <student firstname="Valdar" lastname="Vaht" personalcode="38611265716" code="10091986">
    <subjects>
      <subject name="Mobiilirakenduste arendamine Android platvormile" code="I397" eap="3" />
      <subject name="Võrgurakendused II: hajussüsteemide ehitamine" code="I371" eap="5" />
    </subjects>
  </student>
  <student firstname="Mati" lastname="Turg" personalcode="38609261234" code="10092986">
    <subjects>
      <subject name="Mobiilirakenduste arendamine Android platvormile" code="I397" eap="3" />
      <subject name="Võrgurakendused II: hajussüsteemide ehitamine" code="I371" eap="5" />
    </subjects>
  </student>
</students>

XML 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="students">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="student" minOccurs="1" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="subjects">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="subject" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:attribute name="name" type="xs:string" />
                        <xs:attribute name="code" type="xs:string" />
                        <xs:attribute name="eap" type="xs:int" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="firstname" type="xs:string" />
            <xs:attribute name="lastname" type="xs:string" />
            <xs:attribute name="personalcode" type="xs:long" />
            <xs:attribute name="code" type="xs:int" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XML templiidifail

<?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>
        <h1>Deklaratsioonid</h1>
          <xsl:for-each select="students/student">
            <ul>
              <h3>
                <xsl:value-of select="@firstname"/>&#160;<xsl:value-of select="@lastname"/>
              </h3>
              <ol>
                <xsl:for-each select="subjects/subject">
                  <li>
                    <xsl:value-of select="@name"/>(<xsl:value-of select="@code"/>) <xsl:value-of select="@eap"/> EAP
                  </li>
                </xsl:for-each>
              </ol>
            </ul>
          </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>