Meeskond: HelpOut: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Misarapu (talk | contribs)
Misarapu (talk | contribs)
Line 183: Line 183:
=== XSLT (HTML) ===
=== XSLT (HTML) ===
<source lang="xml">
<source lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<events>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  <event title="Lehekoristus" created="17/03/2017 00:00:00" datetime="18/03/2017 00:00:00" priority="5">
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
     <organizer userid="1"><![CDATA[Piret Pomerants]]></organizer>
     <xsl:output method="html" indent="yes"/>
     <description>
 
       <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
     <xsl:template match="/">
      <main><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.
       <html>
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex,
        <head>
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
            <title>HelpOut</title>
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet,
          </head>
      cu est numquam constituam, veniam discere mei ad.]]></main>
        <body>
    </description>
          <table border="1">
    <participants>
            <tr>
      <participant userid="2" attended="19/03/2017 00:00:00"><![CDATA[Marvin Mardiat]]></participant>
              <th>Ürituse nimi</th>
      <participant userid="3" attended="19/03/2017 00:01:00"><![CDATA[Kerdo Kullamäe]]></participant>
              <th>Korraldaja</th>
      <participant userid="4" attended="19/03/2017 00:02:00"><![CDATA[Martin Paakspuu]]></participant>
              <th>Toimumisaeg</th>
      <participant userid="5" attended="19/03/2017 00:03:00"><![CDATA[Mikk Sarapuu]]></participant>
              <th>Kirjeldus</th>
    </participants>
              <th>Osalejad</th>
    <images>
              <th>Pilt</th>
      <image name="lehed" src="https://s-media-cache-ak0.pinimg.com/originals/81/09/0c/81090cf56edf7b1e8fcc41540f5dde5d.jpg"></image>
              <th>Kommentaarid</th>
    </images>
            </tr>
    <comments>
          <xsl:for-each select="events/event">
      <comment userid="1" reply="false"><![CDATA[lorem ipsum?]]></comment>
            <tr>
      <comment userid="1" reply="true"><![CDATA[test1]]></comment>
              <td>
    </comments>
                <xsl:value-of select ="@title"/>
  </event>
              </td>
  <event title="Puude ladumine" created="17/03/2017 00:00:00" datetime="18/07/2017 00:00:00" priority="5">
              <td>
    <organizer userid="6"><![CDATA[Marko Pomerants]]></organizer>
                <xsl:value-of select ="organizer"/>
    <description>
              </td>
      <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
              <td>
      <main>
                <xsl:value-of select ="@datetime"/>
        <![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.
              </td>
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex,
              <td style="width:400px">
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
                <b><xsl:value-of select ="description/short"/></b>
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet,
                <br/>
      cu est numquam constituam, veniam discere mei ad.]]>
                <xsl:value-of select ="description/main"/>
      </main>
              </td>
    </description>
              <td>
    <participants>
                <ul>
      <participant userid="8" attended="19/07/2017 00:01:00"><![CDATA[Juku Kullamäe]]></participant>
                <xsl:for-each select="participants/participant">
      <participant userid="9" attended="19/07/2017 00:02:00"><![CDATA[Kalvi Paakspuu]]></participant>
                  <li>
      <participant userid="10" attended="19/07/2017 00:03:00"><![CDATA[Kalle Sarapuu]]></participant>
                    <xsl:value-of select ="."/>
    </participants>
                  </li>
    <images>
                </xsl:for-each>
      <image name="puud" src="http://y.delfi.ee/norm/2535/28205_NIE867.jpg"></image>
                </ul>
    </images>
              </td>
    <comments>
 
      <comment userid="7" reply="false"><![CDATA[Kuna üritus toimub?]]></comment>
              <td>
      <comment userid="10" reply="true"><![CDATA[Kas sa ei oska lugeda?]]></comment>
                <xsl:for-each select="images/image">
    </comments>
                  <img width="300px">
  </event>
                    <xsl:attribute name="src">
  <event title='Massistseen kultusfilmis "Maasikad"' created="17/04/2017 00:00:00" datetime="18/04/2017 00:00:00" priority="4">
                      <xsl:value-of select="@src"/>
    <organizer userid="11"><![CDATA[Piret Pakiraam]]></organizer>
                    </xsl:attribute>
    <description>
                  </img>
      <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
                </xsl:for-each>
      <main>
              </td>
        <![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.
              <td>
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex,
                  <xsl:for-each select="comments/comment">
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
                    <xsl:if test="@reply = 'false'">
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet,
                      <b><xsl:value-of select ="."/></b><br/>
      cu est numquam constituam, veniam discere mei ad.]]>
                    </xsl:if>
      </main>
                    <xsl:if test="@reply = 'true'">
    </description>
                      <xsl:value-of select ="."/><br/>
    <participants>
                    </xsl:if>
      <participant userid="12" attended="19/04/2017 00:00:00"><![CDATA[Marvin Pedaalid]]></participant>
                  </xsl:for-each>
      <participant userid="13" attended="19/04/2017 00:01:00"><![CDATA[Kerdo Sadul]]></participant>
              </td>
      <participant userid="14" attended="19/04/2017 00:02:00"><![CDATA[Martin Lenks]]></participant>
             
      <participant userid="15" attended="19/04/2017 00:03:00"><![CDATA[Mikk Kodar]]></participant>
            </tr>
      <participant userid="10" attended="19/04/2017 00:03:00"><![CDATA[Kalle Sarapuu]]></participant>
          </xsl:for-each>
    </participants>
          </table>
    <images>
        </body>
      <image name="rahvas" src="http://www.roscoelilly.org/wp-content/uploads/2016/02/happy-crowd.jpg"></image>
      </html>
    </images>
        
    <comments>
        <!--<xsl:copy>
       <comment userid="12" reply="false"><![CDATA[Mis vanusepiirang?]]></comment>
            <xsl:apply-templates select="@* | node()"/>
      <comment userid="11" reply="false"><![CDATA[Süüa saab ka!]]></comment>
        </xsl:copy>-->
    </comments>
    </xsl:template>
  </event>
</xsl:stylesheet>
</events>


</source>
</source>


=== XSLT (XML) ===
=== XSLT (XML) ===

Revision as of 00:24, 20 March 2017

Meeskond

  • Mikk Sarapuu
  • Martin Paakspuu
  • Kerdo Kullamäe
  • Marvin Mardiat
  • Piret Pomerants

Idee

XML / XSD / XSLT

XML

<?xml version="1.0" encoding="utf-8" ?>
<events>
  <event title="Lehekoristus" created="17/03/2017 00:00:00" datetime="18/03/2017 00:00:00" priority="5">
    <organizer userid="1"><![CDATA[Piret Pomerants]]></organizer>
    <description>
      <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
      <main><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro. 
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex, 
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet, 
      cu est numquam constituam, veniam discere mei ad.]]></main>
    </description>
    <participants>
      <participant userid="2" attended="19/03/2017 00:00:00"><![CDATA[Marvin Mardiat]]></participant>
      <participant userid="3" attended="19/03/2017 00:01:00"><![CDATA[Kerdo Kullamäe]]></participant>
      <participant userid="4" attended="19/03/2017 00:02:00"><![CDATA[Martin Paakspuu]]></participant>
      <participant userid="5" attended="19/03/2017 00:03:00"><![CDATA[Mikk Sarapuu]]></participant>
    </participants>
    <images>
      <image name="lehed" src="https://s-media-cache-ak0.pinimg.com/originals/81/09/0c/81090cf56edf7b1e8fcc41540f5dde5d.jpg"></image>
    </images>
    <comments>
      <comment userid="1" reply="false"><![CDATA[lorem ipsum?]]></comment>
      <comment userid="1" reply="true"><![CDATA[test1]]></comment>
    </comments>
  </event>
  <event title="Puude ladumine" created="17/03/2017 00:00:00" datetime="18/07/2017 00:00:00" priority="5">
    <organizer userid="6"><![CDATA[Marko Pomerants]]></organizer>
    <description>
      <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
      <main>
        <![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro. 
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex, 
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet, 
      cu est numquam constituam, veniam discere mei ad.]]>
      </main>
    </description>
    <participants>
      <participant userid="8" attended="19/07/2017 00:01:00"><![CDATA[Juku Kullamäe]]></participant>
      <participant userid="9" attended="19/07/2017 00:02:00"><![CDATA[Kalvi Paakspuu]]></participant>
      <participant userid="10" attended="19/07/2017 00:03:00"><![CDATA[Kalle Sarapuu]]></participant>
    </participants>
    <images>
      <image name="puud" src="http://y.delfi.ee/norm/2535/28205_NIE867.jpg"></image>
    </images>
    <comments>
      <comment userid="7" reply="false"><![CDATA[Kuna üritus toimub?]]></comment>
      <comment userid="10" reply="true"><![CDATA[Kas sa ei oska lugeda?]]></comment>
    </comments>
  </event>
  <event title='Massistseen kultusfilmis "Maasikad"' created="17/04/2017 00:00:00" datetime="18/04/2017 00:00:00" priority="4">
    <organizer userid="11"><![CDATA[Piret Pakiraam]]></organizer>
    <description>
      <short><![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro.]]></short>
      <main>
        <![CDATA[Lorem ipsum dolor sit amet, est an dicat utinam nostro. 
      Vim inermis repudiandae ad, te eum modo mutat. Mea feugait appareat ex, 
      sed posse luptatum cu, in cum diam dicunt. Nostro scaevola probatus nam ex,
      quo option efficiantur ne. Ei mea pertinacia inciderint dissentiet, 
      cu est numquam constituam, veniam discere mei ad.]]>
      </main>
    </description>
    <participants>
      <participant userid="12" attended="19/04/2017 00:00:00"><![CDATA[Marvin Pedaalid]]></participant>
      <participant userid="13" attended="19/04/2017 00:01:00"><![CDATA[Kerdo Sadul]]></participant>
      <participant userid="14" attended="19/04/2017 00:02:00"><![CDATA[Martin Lenks]]></participant>
      <participant userid="15" attended="19/04/2017 00:03:00"><![CDATA[Mikk Kodar]]></participant>
      <participant userid="10" attended="19/04/2017 00:03:00"><![CDATA[Kalle Sarapuu]]></participant>
    </participants>
    <images>
      <image name="rahvas" src="http://www.roscoelilly.org/wp-content/uploads/2016/02/happy-crowd.jpg"></image>
    </images>
    <comments>
      <comment userid="12" reply="false"><![CDATA[Mis vanusepiirang?]]></comment>
      <comment userid="11" reply="false"><![CDATA[Süüa saab ka!]]></comment>
    </comments>
  </event>
</events>

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="events">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="event">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="organizer">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="userid" type="xs:unsignedByte" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="description">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="short" type="xs:string" />
                    <xs:element name="main" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="participants">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="participant">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="userid" type="xs:unsignedByte" use="required" />
                            <xs:attribute name="attended" type="xs:string" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="images">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="image">
                      <xs:complexType>
                        <xs:attribute name="name" type="xs:string" use="optional" />
                        <xs:attribute name="src" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="comments">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="comment">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="userid" type="xs:unsignedByte" use="required" />
                            <xs:attribute name="reply" type="xs:boolean" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="title" type="xs:string" use="required" />
            <xs:attribute name="created" type="xs:string" use="required" />
            <xs:attribute name="datetime" type="xs:string" use="required" />
            <xs:attribute name="priority" type="xs:unsignedByte" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </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>
        <head>
            <title>HelpOut</title>
          </head>
        <body>
          <table border="1">
            <tr>
              <th>Ürituse nimi</th>
              <th>Korraldaja</th>
              <th>Toimumisaeg</th>
              <th>Kirjeldus</th>
              <th>Osalejad</th>
              <th>Pilt</th>
              <th>Kommentaarid</th>
            </tr>
          <xsl:for-each select="events/event">
            <tr>
              <td>
                <xsl:value-of select ="@title"/>
              </td>
              <td>
                <xsl:value-of select ="organizer"/>
              </td>
              <td>
                <xsl:value-of select ="@datetime"/>
              </td>
              <td style="width:400px">
                <b><xsl:value-of select ="description/short"/></b>
                <br/>
                <xsl:value-of select ="description/main"/>
              </td>
              <td>
                <ul>
                <xsl:for-each select="participants/participant">
                  <li>
                    <xsl:value-of select ="."/>
                  </li>
                </xsl:for-each>
                </ul>
              </td>

              <td>
                <xsl:for-each select="images/image">
                  <img width="300px">
                    <xsl:attribute name="src">
                      <xsl:value-of select="@src"/>
                    </xsl:attribute>
                  </img>
                </xsl:for-each>
              </td>
              <td>
                  <xsl:for-each select="comments/comment">
                    <xsl:if test="@reply = 'false'">
                      <b><xsl:value-of select ="."/></b><br/>
                    </xsl:if>
                    <xsl:if test="@reply = 'true'">
                      <xsl:value-of select ="."/><br/>
                    </xsl:if>
                  </xsl:for-each>
              </td>
              
            </tr>
          </xsl:for-each>
          </table>
        </body>
      </html>
      
        <!--<xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>-->
    </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="/">
      <events>
      <xsl:for-each select="events/event">
        <event>
          <title>
            <xsl:value-of select ="@title"/>
          </title>
          <organizer>
            <xsl:value-of select ="organizer"/>
          </organizer>
          <datetime>
            <xsl:value-of select ="@datetime"/>
          </datetime>
          <description>
            <short>
              <xsl:value-of select ="description/short"/>
            </short>
            <main>
              <xsl:value-of select ="description/main"/>
            </main>
          </description>
          <participants>
              <xsl:for-each select="participants/participant">
                <participant>
                  <xsl:value-of select ="."/>
                </participant>
              </xsl:for-each>
          </participants>

          <images>
            <xsl:for-each select="images/image">
              <image>
                <xsl:attribute name="src">
                  <xsl:value-of select="@src"/>
                </xsl:attribute>
              </image>
            </xsl:for-each>
          </images>
          <comments>
            <xsl:for-each select="comments/comment">
              <xsl:if test="@reply = 'false'">
                <comment>
                  <xsl:value-of select ="."/>
                </comment>
              </xsl:if>
              <xsl:if test="@reply = 'true'">
                <comment>
                <xsl:value-of select ="."/>
                </comment>
              </xsl:if>
            </xsl:for-each>
          </comments>

        </event>
      </xsl:for-each>
      </events>
    </xsl:template>
</xsl:stylesheet>

Arendusprotsess

  • 19.03.2017 - teema valik, wiki lehe loomine, xml loomine