Givela: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Vrokovan (talk | contribs)
Vrokovan (talk | contribs)
Line 99: Line 99:
<pre>
<pre>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  <xs:element name="Products">
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
     <xs:complexType>
>
       <xs:sequence>
    <xsl:output method="html" indent="yes"/>
         <xs:element name="Persons">
 
           <xs:complexType>
     <xsl:template match="/">
            <xs:sequence>
       <html>
              <xs:element maxOccurs="unbounded" name="Person" type="xs:string" />
         <head>
            </xs:sequence>
       
           </xs:complexType>
           <title>Tooted</title>
        </xs:element>
          <!-- Essential CSS Files -->
        <xs:element name="Categories">
          <link rel="stylesheet" href="http://enos.itcollege.ee/~vrokovan/bootstrap/css/bootstrap.min.css"/>
          <xs:complexType>
         
            <xs:sequence>
        </head>
              <xs:element maxOccurs="unbounded" name="Category" type="xs:string" />
        <body>
            </xs:sequence>
           <div class="container">
          </xs:complexType>
            <xsl:for-each select="/Products/Categories/Category">
        </xs:element>
              <xsl:variable name="MainCategory" select="."></xsl:variable>
        <xs:element maxOccurs="unbounded" name="Product">
              <!--
          <xs:complexType>
              <li>
            <xs:sequence>
                <xsl:value-of select="."/>
              <xs:element name="Name" type="xs:string" />
              </li>-->
              <xs:element name="Person" type="xs:string" />
              <h2>
              <xs:element name="Category" type="xs:string" />
                <xsl:value-of select="$MainCategory"/>
              <xs:element name="ImageUrl" type="xs:string" />
              </h2>
              <xs:element name="Comments">
              <ul>
                <xs:complexType>
                <xsl:for-each select="/Products/Product">
                  <xs:sequence>
 
                     <xs:element maxOccurs="unbounded" name="Comment" type="xs:string" />
                  <xsl:variable select="." name="Product"></xsl:variable>
                   </xs:sequence>
                  <xsl:if test="Category = $MainCategory">
                 </xs:complexType>
                    <li>
               </xs:element>
                      <p>
             </xs:sequence>
                        <xsl:value-of select="$Product/Name"/>
           </xs:complexType>
 
         </xs:element>
                        Kasutaja: <xsl:value-of select="$Product/Person"/>
       </xs:sequence>
                      </p>
     </xs:complexType>
                      <img width="100px">
  </xs:element>
                        <xsl:attribute name="src" >
</xs:schema>
                          <xsl:value-of select="$Product/ImageUrl"/>
                        </xsl:attribute>
                      </img>
 
                      <!--
                    <img src="{$Movie/ImageUrl/.}" width="100" height="100" />
                    -->
                    </li>
 
                    <ul>
                      <xsl:for-each select="Comments/Comment">
                        <li>
                          <xsl:value-of select="."/>
                        </li>
                      </xsl:for-each>
                     </ul>
                   </xsl:if>
                 </xsl:for-each>
               </ul>
             </xsl:for-each>
           </div>
         </body>
       </html>
     </xsl:template>
</xsl:stylesheet>
</pre>
</pre>


== Logi ==
== Logi ==
#09.03.16 - Esimene kohtumine
#09.03.16 - Esimene kohtumine

Revision as of 13:35, 16 March 2016

Kodutöö aines "Võrgurakendused II: hajussüsteemide ehitamine"

Meeskond

  • Mikk Raudsepp
  • Alar Ameerikas
  • Vladimir Rõkovanov

Idee

XML/XSD/XSLT

XML

<?xml version="1.0" encoding="utf-8" ?>
<Products>
  <Persons>
    <Person><![CDATA[Mikk]]></Person>
    <Person><![CDATA[Alar]]></Person>
    <Person><![CDATA[Vladimir]]></Person>
  </Persons>
  <Categories>
    <Category><![CDATA[Riided]]></Category>
    <Category><![CDATA[Köögitehnika]]></Category>
  </Categories>
  <Product>
    <Name><![CDATA[Siidisukad 160]]></Name>
    <Person><![CDATA[Mikk]]></Person>
    <Category><![CDATA[Riided]]></Category>
    <ImageUrl>http://enos.itcollege.ee/~vrokovan/haju/sukad.jpg</ImageUrl>
    <Comments>
      <Comment><![CDATA[Kus asute?]]></Comment>
      <Comment><![CDATA[Kas on uued või kasutatud]]></Comment>
    </Comments>
  </Product>
  <Product>
    <Name><![CDATA[Külmkapp]]></Name>
    <Person><![CDATA[Alar]]></Person>
    <Category><![CDATA[Köögitehnika]]></Category>
    <ImageUrl>http://enos.itcollege.ee/~vrokovan/haju/kylmik.jpg</ImageUrl>
    <Comments>
      <Comment><![CDATA[Saatke mõõdud palun]]></Comment>
      <Comment><![CDATA[kui vana külmkapp on?]]></Comment>
    </Comments>
  </Product>
  <Product>
    <Name><![CDATA[Veekeetja]]></Name>
    <Person><![CDATA[Vladimir]]></Person>
    <Category><![CDATA[Köögitehnika]]></Category>
    <ImageUrl>http://enos.itcollege.ee/~vrokovan/haju/keetja.jpg</ImageUrl>
    <Comments>
      <Comment><![CDATA[Kas on töökorras?]]></Comment>
      <Comment><![CDATA[mitme liitrine on?]]></Comment>
    </Comments>
  </Product>
</Products>

<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="Products">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="Persons">
         <xs:complexType>
           <xs:sequence>
             <xs:element maxOccurs="unbounded" name="Person" type="xs:string" />
           </xs:sequence>
         </xs:complexType>
       </xs:element>
       <xs:element name="Categories">
         <xs:complexType>
           <xs:sequence>
             <xs:element maxOccurs="unbounded" name="Category" type="xs:string" />
           </xs:sequence>
         </xs:complexType>
       </xs:element>
       <xs:element maxOccurs="unbounded" name="Product">
         <xs:complexType>
           <xs:sequence>
             <xs:element name="Name" type="xs:string" />
             <xs:element name="Person" type="xs:string" />
             <xs:element name="Category" type="xs:string" />
             <xs:element name="ImageUrl" type="xs:string" />
             <xs:element name="Comments">
               <xs:complexType>
                 <xs:sequence>
                   <xs:element maxOccurs="unbounded" name="Comment" type="xs:string" />
                 </xs:sequence>
               </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>Tooted</title>
          <!-- Essential CSS Files -->
          <link rel="stylesheet" href="http://enos.itcollege.ee/~vrokovan/bootstrap/css/bootstrap.min.css"/>
          
        </head>
        <body>
          <div class="container">
            <xsl:for-each select="/Products/Categories/Category">
              <xsl:variable name="MainCategory" select="."></xsl:variable>
              <!--
              <li>
                <xsl:value-of select="."/>
              </li>-->
              <h2>
                <xsl:value-of select="$MainCategory"/>
              </h2>
              <ul>
                <xsl:for-each select="/Products/Product">

                  <xsl:variable select="." name="Product"></xsl:variable>
                  <xsl:if test="Category = $MainCategory">
                    <li>
                      <p>
                        <xsl:value-of select="$Product/Name"/>

                        Kasutaja: <xsl:value-of select="$Product/Person"/>
                      </p>
                      <img width="100px">
                        <xsl:attribute name="src"  >
                          <xsl:value-of select="$Product/ImageUrl"/>
                        </xsl:attribute>
                      </img>

                      <!--
                    <img src="{$Movie/ImageUrl/.}" width="100" height="100" />
                    -->
                    </li>

                    <ul>
                      <xsl:for-each select="Comments/Comment">
                        <li>
                          <xsl:value-of select="."/>
                        </li>
                      </xsl:for-each>
                    </ul>
                  </xsl:if>
                </xsl:for-each>
              </ul>
            </xsl:for-each>
          </div>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Logi

  1. 09.03.16 - Esimene kohtumine