Meeskond:NoMethodError: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Msavila (talk | contribs)
Msavila (talk | contribs)
Line 79: Line 79:


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

Revision as of 10:58, 7 March 2015

Meeskond

Liige:

  • Murdho Savila

XML

XML

Pangakontod koos tehingutega.

<?xml version="1.0" encoding="utf-8"?>
<accounts type="array" order_by="created_at:DESC">
  <account>
    <id type="integer">476</id>
    <customer-id type="integer">115</customer-id>
    <refno>867625001039617</refno>
    <balance type="decimal">120.0</balance>
    <created-at type="dateTime">2015-01-01T15:30:00+02:00</created-at>
    <transactions type="array" order_by="transaction_at:ASC" >
      <transaction type="account_transaction">
        <id type="integer">1994</id>
        <account-id type="integer">476</account-id>
        <transaction-at type="date">2015-03-06</transaction-at>
        <amount type="decimal">150.0</amount>
        <account-balance type="decimal">0.0</account-balance>
        <debtor-id type="integer">56</debtor-id>
        <creditor-id type="integer">115</creditor-id>
        <description><![CDATA[Ülekanne]]></description>
        <created-at type="dateTime">2015-03-05T22:54:54+02:00</created-at>
      </transaction>
      <transaction type="account_transaction">
        <id type="integer">2013</id>
        <account-id type="integer">476</account-id>
        <transaction-at type="date">2015-03-07</transaction-at>
        <amount type="decimal">-30.0</amount>
        <account-balance type="decimal">150.0</account-balance>
        <debtor-id type="integer">115</debtor-id>
        <creditor-id type="integer">25</creditor-id>
        <description><![CDATA[6762593001039618 06.03.15 19:01 Vapiano restoran Sola\\Tallinn \EST]]></description>
        <created-at type="dateTime">2015-03-07T06:30:11+02:00</created-at>
      </transaction>
    </transactions>
  </account>
  <account>
    <id type="integer">351</id>
    <customer-id type="integer">78</customer-id>
    <refno>867625001030245</refno>
    <balance type="decimal">250.0</balance>
    <created-at type="dateTime">2014-11-29T11:10:59+02:00</created-at>
    <transactions type="array" order_by="transaction_at:DESC">
      <transaction type="account_transaction">
        <id type="integer">1930</id>
        <account-id type="integer">351</account-id>
        <transaction-at type="date">2015-02-28</transaction-at>
        <amount type="decimal">-120.0</amount>
        <account-balance type="decimal">370.0</account-balance>
        <debtor-id type="integer">78</debtor-id>
        <creditor-id type="integer">11</creditor-id>
        <description><![CDATA[6762593001039618 26.02.15 19:31 KAUBAMAJA TALLINN \\TALLINN \EST]]></description>
        <created-at type="dateTime">2015-02-28T06:31:42+02:00</created-at>
      </transaction>
      <transaction type="account_transaction">
        <id type="integer">1799</id>
        <account-id type="integer">351</account-id>
        <transaction-at type="date">2015-02-25</transaction-at>
        <amount type="decimal">240.0</amount>
        <account-balance type="decimal">130.0</account-balance>
        <debtor-id type="integer">101</debtor-id>
        <creditor-id type="integer">78</creditor-id>
        <description><![CDATA[Võla tasumine]]></description>
        <created-at type="dateTime">2015-02-25T06:42:00+02:00</created-at>
      </transaction>
    </transactions>
  </account>
</accounts>

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="accounts">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="account" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="id">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:integer">
                      <xs:attribute type="xs:string" name="type" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="customer-id">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:integer">
                      <xs:attribute type="xs:string" name="type" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element type="xs:string" name="refno"/>
              <xs:element name="balance">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:decimal">
                      <xs:attribute type="xs:string" name="type" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="created-at">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:dateTime">
                      <xs:attribute type="xs:string" name="type" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="transactions">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="transaction" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="id">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:integer">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="account-id">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:integer">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="transaction-at">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:date">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="amount">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:decimal">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="account-balance">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:decimal">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="debtor-id">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:integer">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="creditor-id">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:integer">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element type="xs:string" name="description"/>
                          <xs:element name="created-at">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:dateTime">
                                  <xs:attribute type="xs:string" name="type" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute type="xs:string" name="type" use="optional"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute type="xs:string" name="type" use="optional"/>
                  <xs:attribute type="xs:string" name="order_by" use="optional"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute type="xs:string" name="type"/>
      <xs:attribute type="xs:string" name="order_by"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT

XSLT => HTML: kontode ja nendega seotud tehingute kuvamine.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/accounts">
    <html>
      <head>
        <title>Accounts with transactions</title>
      </head>
      <body>
        <h2>Accounts with transactions</h2>
        <hr/>
        <xsl:for-each select="account">
          <h3>Account with transactions</h3>
          <table border="1">
            <tr>
              <td>ID</td>
              <td><xsl:value-of select="id"/></td>
            </tr>
            <tr>
              <td>Customer ID</td>
              <td><xsl:value-of select="customer-id"/></td>
            </tr>
            <tr>
              <td>Refno</td>
              <td><xsl:value-of select="refno"/></td>
            </tr>
            <tr>
              <td>Balance</td>
              <td><xsl:value-of select="balance"/> </td>
            </tr>
            <tr>
              <td>Created at</td>
              <td><xsl:value-of select="created-at"/></td>
            </tr>
          </table>

          <h4>Account transactions</h4>
          <table border="1">
            <xsl:for-each select="transactions/transaction">
              <tr>
                <th>ID</th>
                <th>Account ID</th>
                <th>Transaction at</th>
                <th>Amount (€)</th>
                <th>Account balance (€)</th>
                <th>Debtor ID</th>
                <th>Creditor ID</th>
                <th>Description</th>
                <th>Created at</th>
              </tr>
              <tr>
                <td><xsl:value-of select="id"/></td>
                <td><xsl:value-of select="account-id"/></td>
                <td><xsl:value-of select="transaction-at"/></td>
                <td><xsl:value-of select="amount"/></td>
                <td><xsl:value-of select="account-balance"/></td>
                <td><xsl:value-of select="debtor-id"/></td>
                <td><xsl:value-of select="creditor-id"/></td>
                <td><xsl:value-of select="description"/></td>
                <td><xsl:value-of select="created-at"/></td>
              </tr>
            </xsl:for-each>
          </table>
          <br/>
          <hr/>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


XSLT => XML: kontode viitenumbrite ja jääkide kuvamine (kontojäägi järgi kahanevalt)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/accounts">
    <accounts type="array" order_by="balance:DESC">
      <xsl:for-each select="account">
        <xsl:sort select="balance" order="descending"/>
        <account>
          <refno>
            <xsl:value-of select="refno"/>
          </refno>
          <balance type="decimal">
            <xsl:value-of select="balance"/>
          </balance>
        </account>
      </xsl:for-each>
    </accounts>
  </xsl:template>
</xsl:stylesheet>

Veebiteenus

Klientrakendused