Kirde sai

From ICO wiki
Revision as of 16:07, 20 March 2017 by Tteearu (talk | contribs) (→‎XML)
Jump to navigationJump to search

Team "Kirde sai"

  • Taavi Teearu


XML/XSD/XSLT

XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with XML Spy v2006 (http://www.altova.com) -->
<CATALOG Id="1" Name="Herbarium">
  <DIM2 Id="1" Name="DIM 2.1" >
    <PLANT SpiritAnimal="Fox">
      <COMMON>Bloodroot</COMMON>
      <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$2.44</PRICE>
      <AVAILABILITY>031599</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Squirrel">
      <COMMON>Columbine</COMMON>
      <BOTANICAL>Aquilegia canadensis</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$9.37</PRICE>
      <AVAILABILITY>030699</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Rabbit">
      <COMMON>Marsh Marigold</COMMON>
      <BOTANICAL>Caltha palustris</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Sunny</LIGHT>
      <PRICE>$6.81</PRICE>
      <AVAILABILITY>051799</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Ant">
      <COMMON>Cowslip</COMMON>
      <BOTANICAL>Caltha palustris</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$9.90</PRICE>
      <AVAILABILITY>030699</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Elephant">
      <COMMON>Dutchman's-Breeches</COMMON>
      <BOTANICAL>Dicentra cucullaria</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$6.44</PRICE>
      <AVAILABILITY>012099</AVAILABILITY>
    </PLANT>
  </DIM2>
  <DIM2 Id="2" Name="DIM 2.2">
    <PLANT SpiritAnimal="Fox">
      <COMMON>Ginger, Wild</COMMON>
      <BOTANICAL>Asarum canadense</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$9.03</PRICE>
      <AVAILABILITY>041899</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Rat">
      <COMMON>Hepatica</COMMON>
      <BOTANICAL>Hepatica americana</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$4.45</PRICE>
      <AVAILABILITY>012699</AVAILABILITY>
    </PLANT>
    <PLANT  SpiritAnimal="Hippo">
      <COMMON>Liverleaf</COMMON>
      <BOTANICAL>Hepatica americana</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$3.99</PRICE>
      <AVAILABILITY>010299</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Lion">
      <COMMON>Jack-In-The-Pulpit</COMMON>
      <BOTANICAL>Arisaema triphyllum</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$3.23</PRICE>
      <AVAILABILITY>020199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Zebra">
      <COMMON>Mayapple</COMMON>
      <BOTANICAL>Podophyllum peltatum</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$2.98</PRICE>
      <AVAILABILITY>060599</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Alien">
      <COMMON>Phlox, Woodland</COMMON>
      <BOTANICAL>Phlox divaricata</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$2.80</PRICE>
      <AVAILABILITY>012299</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Beaver">
      <COMMON>Phlox, Blue</COMMON>
      <BOTANICAL>Phlox divaricata</BOTANICAL>
      <ZONE>3</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$5.59</PRICE>
      <AVAILABILITY>021699</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Moose">
      <COMMON>Spring-Beauty</COMMON>
      <BOTANICAL>Claytonia Virginica</BOTANICAL>
      <ZONE>7</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$6.59</PRICE>
      <AVAILABILITY>020199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Monkey">
      <COMMON>Trillium</COMMON>
      <BOTANICAL>Trillium grandiflorum</BOTANICAL>
      <ZONE>5</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$3.90</PRICE>
      <AVAILABILITY>042999</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Snake">
      <COMMON>Wake Robin</COMMON>
      <BOTANICAL>Trillium grandiflorum</BOTANICAL>
      <ZONE>5</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$3.20</PRICE>
      <AVAILABILITY>022199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Frog">
      <COMMON>Violet, Dog-Tooth</COMMON>
      <BOTANICAL>Erythronium americanum</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$9.04</PRICE>
      <AVAILABILITY>020199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Dragon">
      <COMMON>Trout Lily</COMMON>
      <BOTANICAL>Erythronium americanum</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$6.94</PRICE>
      <AVAILABILITY>032499</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Shrek">
      <COMMON>Adder's-Tongue</COMMON>
      <BOTANICAL>Erythronium americanum</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$9.58</PRICE>
      <AVAILABILITY>041399</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Cyclope">
      <COMMON>Anemone</COMMON>
      <BOTANICAL>Anemone blanda</BOTANICAL>
      <ZONE>6</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$8.86</PRICE>
      <AVAILABILITY>122698</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Tiger">
      <COMMON>Grecian Windflower</COMMON>
      <BOTANICAL>Anemone blanda</BOTANICAL>
      <ZONE>6</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$9.16</PRICE>
      <AVAILABILITY>071099</AVAILABILITY>
    </PLANT>
  </DIM2>
  <DIM2 Id="3" Name="DIM 2.3">
    <PLANT SpiritAnimal="Cat">
      <COMMON>Bee Balm</COMMON>
      <BOTANICAL>Monarda didyma</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$4.59</PRICE>
      <AVAILABILITY>050399</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Dog">
      <COMMON>Bergamot</COMMON>
      <BOTANICAL>Monarda didyma</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$7.16</PRICE>
      <AVAILABILITY>042799</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Cow">
      <COMMON>Black-Eyed Susan</COMMON>
      <BOTANICAL>Rudbeckia hirta</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Sunny</LIGHT>
      <PRICE>$9.80</PRICE>
      <AVAILABILITY>061899</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Pig">
      <COMMON>Buttercup</COMMON>
      <BOTANICAL>Ranunculus</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$2.57</PRICE>
      <AVAILABILITY>061099</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Dolphin">
      <COMMON>Crowfoot</COMMON>
      <BOTANICAL>Ranunculus</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$9.34</PRICE>
      <AVAILABILITY>040399</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Blue whale">
      <COMMON>Butterfly Weed</COMMON>
      <BOTANICAL>Asclepias tuberosa</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Sunny</LIGHT>
      <PRICE>$2.78</PRICE>
      <AVAILABILITY>063099</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Donkey">
      <COMMON>Cinquefoil</COMMON>
      <BOTANICAL>Potentilla</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$7.06</PRICE>
      <AVAILABILITY>052599</AVAILABILITY>
    </PLANT>
  </DIM2>
  <DIM2 Id="4" Name="DIM 2.4">
    <PLANT SpiritAnimal="Mouse">
      <COMMON>Primrose</COMMON>
      <BOTANICAL>Oenothera</BOTANICAL>
      <ZONE>3 - 5</ZONE>
      <LIGHT>Sunny</LIGHT>
      <PRICE>$6.56</PRICE>
      <AVAILABILITY>013099</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Horse">
      <COMMON>Gentian</COMMON>
      <BOTANICAL>Gentiana</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$7.81</PRICE>
      <AVAILABILITY>051899</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Wolf">
      <COMMON>Blue Gentian</COMMON>
      <BOTANICAL>Gentiana</BOTANICAL>
      <ZONE>4</ZONE>
      <LIGHT>Sun or Shade</LIGHT>
      <PRICE>$8.56</PRICE>
      <AVAILABILITY>050299</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Bear">
      <COMMON>Jacob's Ladder</COMMON>
      <BOTANICAL>Polemonium caeruleum</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$9.26</PRICE>
      <AVAILABILITY>022199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Lynx">
      <COMMON>Greek Valerian</COMMON>
      <BOTANICAL>Polemonium caeruleum</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$4.36</PRICE>
      <AVAILABILITY>071499</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Deer">
      <COMMON>California Poppy</COMMON>
      <BOTANICAL>Eschscholzia californica</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Sun</LIGHT>
      <PRICE>$7.89</PRICE>
      <AVAILABILITY>032799</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Kangaroo">
      <COMMON>Shooting Star</COMMON>
      <BOTANICAL>Dodecatheon</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Mostly Shady</LIGHT>
      <PRICE>$8.60</PRICE>
      <AVAILABILITY>051399</AVAILABILITY>
    </PLANT>
  </DIM2>
  <DIM2 Id="5" Name="DIM 2.5">
    <PLANT SpiritAnimal="Lamb">
      <COMMON>Snakeroot</COMMON>
      <BOTANICAL>Cimicifuga</BOTANICAL>
      <ZONE>Annual</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$5.63</PRICE>
      <AVAILABILITY>071199</AVAILABILITY>
    </PLANT>
    <PLANT SpiritAnimal="Leopard">
      <COMMON>Cardinal Flower</COMMON>
      <BOTANICAL>Lobelia cardinalis</BOTANICAL>
      <ZONE>2</ZONE>
      <LIGHT>Shade</LIGHT>
      <PRICE>$3.02</PRICE>
      <AVAILABILITY>022299</AVAILABILITY>
    </PLANT>
  </DIM2>
</CATALOG>


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="CATALOG">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="unbounded" name="DIM2">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="1" maxOccurs="unbounded" name="PLANT">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="COMMON" type="xs:string" />
                    <xs:element name="BOTANICAL" type="xs:string" />
                    <xs:element name="ZONE" type="xs:string" />
                    <xs:element name="LIGHT" type="xs:string" />
                    <xs:element name="PRICE" type="xs:string" />
                    <xs:element name="AVAILABILITY" type="xs:unsignedInt" />
                  </xs:sequence>
                  <xs:attribute name="SpiritAnimal" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Id" type="xs:unsignedInt" use="required" />
            <xs:attribute name="Name" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="Id" type="xs:unsignedInt" use="required" />
      <xs:attribute name="Name" type="xs:string" use="required" />
    </xs:complexType>
  </xs:element>
</xs:schema>


XSLT HTML

<?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>My plants</h1>
        <h4>Color coded by value of availability fitting in range</h4>
        <table>
          <tr>
            <td width="300px">
              <b>Common name</b>
            </td>
            <td width="100px" bgcolor="yellow">
              <b>Light contitions</b>
            </td>
            <td width="70px">
              <b>Dollar tokens</b>
            </td>
          </tr>
          <xsl:for-each select="/CATALOG/DIM2/PLANT">
            <tr>
              <td width="300px">
                <xsl:value-of select="COMMON"/>
              </td>

              <xsl:choose>
                <xsl:when test="./AVAILABILITY &lt; 020000">
                  <td width="150px" bgcolor="orange">
                    <xsl:value-of select="LIGHT"/>
                  </td>
                </xsl:when>
                <xsl:when test="./AVAILABILITY &lt; 030000">
                  <td width="150px" bgcolor="green">
                    <xsl:value-of select="LIGHT"/>
                  </td>
                </xsl:when>
                <xsl:when test="./AVAILABILITY &lt; 050000">
                  <td width="150px" bgcolor="blue">
                    <xsl:value-of select="LIGHT"/>
                  </td>
                </xsl:when>
                <xsl:otherwise>
                  <td width="150px">
                    <xsl:value-of select="LIGHT"/>
                  </td>
                </xsl:otherwise>
              </xsl:choose>

              <td width="70px">
                <xsl:value-of select="PRICE"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


XSLT XML

<?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="xml" indent="yes"/>

  <xsl:template match="/">
    <html>
      <body>
        <h1>Plants sorted by availability in separate XML dimensions. Only entries with availability below 050000 are shown.</h1>
        <xsl:for-each select="/CATALOG/DIM2">
          <h3>
            <xsl:value-of select="@Name"/>
          </h3>
          <ol>
            <xsl:for-each select="PLANT">
              <xsl:sort select="AVAILABILITY"/>
              <xsl:for-each select=".">
                <xsl:variable name="av" select="050000"/>
                <xsl:if test="./AVAILABILITY &lt; $av">
                  <li>
                    <b>
                      <xsl:value-of select="BOTANICAL"/>
                    </b><br/>
                    Availability: <xsl:value-of select="AVAILABILITY"/><br/>
                    Zone: <xsl:value-of select="ZONE"/>
                  </li>
                </xsl:if>
              </xsl:for-each>
            </xsl:for-each>
          </ol>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


Output

HTML output of given XSLT HTML
XSLT HTML output
XML output of given XSLT XML
XSLT XML output

Veebiteenus

Analüüs

Teenus

Klientrakendused

Retsensioonid

XML-failid

Veebiteenus

Klientrakendus