Backbone

From ICO wiki
Jump to navigationJump to search

Backbone

Meeskonna liikmed

  • Mikk Visnap
  • Silver Lumi


XML andmefail

XML fail

<?xml version="1.0" encoding="utf-8" ?>
<sales>
  <sale id="1000">
    <saleHeader>
      <saleDate>2015-01-04</saleDate>
      <totalAmount>5000</totalAmount>
      <vatAmount percentage="20">4166</vatAmount>
      <salesPerson personId="6"><![CDATA[Silver Lumi]]></salesPerson>
      <client clientId="987"><![CDATA[Federico Garcia Lorca]]></client>    
    </saleHeader>
    <saleRows>
      <saleRow rowNumber="1">
        <product id="12345" unit="kg" quantity="200" value="500" currency="EUR" conversionToEur="1.0"><![CDATA[Ham]]></product>
      </saleRow>
      <saleRow rowNumber="2">
        <product id="54321" unit="kg" quantity="100" value="2500" currency="EUR" conversionToEur="1.0"><![CDATA[Cheese]]></product>
      </saleRow>
      <saleRow rowNumber="3">
        <product id="98521" unit="g" quantity="750" value="55" currency="EUR" conversionToEur="1.0"><![CDATA[Sugar]]></product>
      </saleRow>
      <saleRow rowNumber="4">
        <product id="1112" unit="liter" quantity="47" value="1999" currency="EUR" conversionToEur="1.0"><![CDATA[Olive oil]]></product>
      </saleRow>
    </saleRows>
  </sale>
  <sale id="1001">
    <saleHeader>
        <saleDate>2015-01-04</saleDate>
        <totalAmount>19000</totalAmount>
        <vatAmount percentage="20">15833</vatAmount>
        <salesPerson personId="7"><![CDATA[Mait Poska]]></salesPerson>
        <client clientId="885"><![CDATA[Jose Lopez Añudo]]></client>   
    </saleHeader>
    <saleRows>
      <saleRow rowNumber="1">
        <product id="5147" unit="g" quantity="125" value="19" currency="EUR" conversionToEur="1.0"><![CDATA[Chocolate]]></product>
      </saleRow>
      <saleRow rowNumber="2">
        <product id="5151" unit="kg" quantity="25" value="250" currency="EUR" conversionToEur="1.0"><![CDATA[Butter]]></product>
      </saleRow>
      <saleRow rowNumber="3">
        <product id="1112" unit="liter" quantity="50" value="2050" currency="EUR" conversionToEur="1.0"><![CDATA[Olive oil]]></product>
      </saleRow>
    </saleRows>
  </sale>
  <sale id="1002">
    <saleHeader>
        <saleDate>2015-01-05</saleDate>
        <totalAmount>749</totalAmount>
        <vatAmount percentage="20">624</vatAmount>
        <salesPerson personId="1"><![CDATA[Mati Mäeots]]></salesPerson>
        <client clientId="885"><![CDATA[Mario Vargas Llosa]]></client>   
    </saleHeader>
    <saleRows>
      <saleRow rowNumber="1">
        <product id="4444" unit="kg" quantity="51" value="1" currency="EUR" conversionToEur="1.0"><![CDATA[Sugar]]></product>
      </saleRow>
       <saleRow rowNumber="2">
        <product id="6666" unit="kg" quantity="750" value="2500" currency="EUR" conversionToEur="1.0"><![CDATA[Ketchup]]></product>
      </saleRow>
    </saleRows>
  </sale>
  <sale id="1003">
    <saleHeader>
      <saleDate>2015-01-05</saleDate>
      <totalAmount>749</totalAmount>
      <vatAmount percentage="20">624</vatAmount>
      <salesPerson personId="1"><![CDATA[Mikk Visnap]]></salesPerson>
      <client clientId="885"><![CDATA[Some One]]></client>
    </saleHeader>
    <saleRows>
      <saleRow rowNumber="1">
        <product id="4444" unit="kg" quantity="10" value="10" currency="USD" conversionToEur="1.5"><![CDATA[Sugar]]></product>
      </saleRow>
      <saleRow rowNumber="2">
        <product id="4444" unit="kg" quantity="10" value="10" currency="SEK" conversionToEur="2"><![CDATA[Sugar]]></product>
      </saleRow>
    </saleRows>
  </sale>
</sales>

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="sales">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="sale">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="saleHeader">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="saleDate" type="xs:date" />
                    <xs:element name="totalAmount" type="xs:decimal" />
                    <xs:element name="vatAmount">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:unsignedShort">
                            <xs:attribute name="percentage" type="xs:unsignedByte" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="salesPerson">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="personId" type="xs:unsignedInt" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="client">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="clientId" type="xs:unsignedInt" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="saleRows">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="saleRow">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="product">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="id" type="xs:unsignedInt" use="required" />
                                  <xs:attribute name="unit" type="xs:string" use="required" />
                                  <xs:attribute name="quantity" type="xs:decimal" use="required" />
                                  <xs:attribute name="value" type="xs:decimal" use="required" />
                                  <xs:attribute name="currency" type="xs:string" use="required" />
                                  <xs:attribute name="conversionToEur" type="xs:decimal" use="required" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="rowNumber" type="xs:unsignedByte" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:unsignedShort" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT failid

Kuvab kõik XML failis toodud müügid ning müügiarve read

<?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>All Sales</title>
      </head>
      <body>
        <h1>All Sales</h1>
        <xsl:for-each select="sales/sale">
            <h2>Client: 
              <xsl:value-of select="saleHeader/client"/>
            </h2>
            <h3>Sales rep: 
              <xsl:value-of select="saleHeader/salesPerson"/>
            </h3>
            <ol>
              <xsl:for-each select="saleRows/saleRow">
                <li>
                  <xsl:text>Sale of </xsl:text>
                  <xsl:value-of select="product/@quantity"/>
                  <xsl:text> </xsl:text>
                  <xsl:value-of select="product/@unit"/>
                  <xsl:text> of </xsl:text>
                  <xsl:value-of select="product"/>
                  <xsl:text> @ </xsl:text>
                  <xsl:value-of select="product/@value"/>
                  <xsl:text> </xsl:text>
                  <xsl:value-of select="product/@currency"/>
                  <xsl:text>/</xsl:text>
                  <xsl:value-of select="product/@unit"/>
                  <xsl:text>. Sale value </xsl:text>
                  <xsl:value-of select="product/@value * product/@quantity"/>
                  <xsl:text> </xsl:text>
                  <xsl:value-of select="product/@currency"/>
                  <xsl:text>.</xsl:text>
                </li>
              </xsl:for-each>
              <br />
              <br />
            </ol>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>



Otsib XML'ist välja need müügid, milles esines toode "SUGAR" ja kuvab need müügid

<?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>SEARCH RESULTS</title>
          <style type="text/css">
           table {
            text-align: left;
            }            
          </style>
        </head>
        <body>
          <table>
            <tr>
              <th colspan="2" style="color:blue">SEARCH RESULTS</th>              
            </tr>
            <tr>
              <th colspan="2" style="border-bottom:1px dotted black">showing all the sales where SUGAR was one of the components</th>
            </tr>
            <tr>
              <th colspan="2"> </th>
            </tr>
                <xsl:for-each select="sales/sale[saleRows/saleRow/product[string(.)='Sugar']]">

                  <tr>
                    <th>Sales Date</th>
                    <td><xsl:value-of select="saleHeader/saleDate"/></td>                    
                  </tr>
                  <tr>
                    <th>Salesperson</th>
                    <td>
                      <xsl:value-of select="saleHeader/salesPerson"/>
                    </td>
                  </tr>
                  <tr>
                    <th>Client</th>
                    <td>
                      <xsl:value-of select="saleHeader/client"/>
                    </td>
                  </tr>
                  
                  <xsl:for-each select="saleRows/saleRow">
                    <tr>
                      <th>Product <xsl:value-of select="@rowNumber"/>
                    </th>
                      <td><xsl:value-of select="product"/></td>
                    </tr>                    
                  </xsl:for-each>
                  <tr>
                    <th colspan="2" style="background-color:red"></th>
                  </tr>
                  <tr>
                    <th colspan="2"> </th>
                  </tr>
                </xsl:for-each>             
          </table>          
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

Veebiteenuse analüüs

Veebiteenus

Klientrankendus

To-do