|
|
(3 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| == Meeskond == | | == Meeskond == |
| * Lauri Jansen - wiki, XML | | * Lauri Jansen - wiki, XML, schema |
| * Tanel Jüris | | * Tanel Jüris - XSLT XML-i |
| * Madis Rääk | | * Madis Rääk - XSLT html-i |
|
| |
|
| == Idee ==
| | Asume uuel aadressil [[PhoneBook]] |
| Luua näidisteemades välja pakutud telefoniraamatu teenus kus:
| |
| * kasutaja saab teenuses kontakte lisada ja kustutada
| |
| * kasutaja saab kontaktide nime/telefoninumbri jne abil otsida
| |
| * luua võimalus ühele kasutajale (või erinevatele kasutajagruppidele) maksimumpäringute hulga määramiseks
| |
|
| |
|
| Kusjuures on olemas ka lisavõimalused:
| | == Log == |
| * luua võimalus kasutajatel oma kontaktibaase omavahel jagada
| |
| * luua võimalus pakkuda kontaktibaasis leiduvate nimede järgi sobivaid nimesid
| |
| | |
| == XML fail == | |
| Ülesande täitmiseks tuleb luua XML fail andmete edastamiseks, selle XML faili skeemifail ning paar kolm sobivat XSL faili loodud XML failis olevate andmete transformeerimiseks HTML formaati ja XML faili formaadi muutmiseks.
| |
| | |
| XML-il peab olema vähemalt 4 loogilist dimensiooni.
| |
| | |
| Lisaks tuleb kasutada 3-el dimensioonil attribuute, mis on enamat, kui lihtsalt ID.
| |
| === XML ===
| |
| <pre>
| |
|
| |
|
| <?xml version="1.0" encoding="utf-8"?>
| | === 05.03.2012 === |
| | * Kolisime korrektsele lingile [[PhoneBook]] |
|
| |
|
| <contacts>
| | === 03.03.2012 === |
| <contact id="1">
| | * XSLT XML transformatsiooni lisamine wikisse. |
|
| |
| <names>
| |
| <first_name> Mart </first_name>
| |
| <middle_names>
| |
| <middle_name></middle_name>
| |
| </middle_names>
| |
| <last_name> Tamm </last_name>
| |
| </names>
| |
| <addresses default="1">
| |
| <address id="1">
| |
| <country> Eesti </country>
| |
| <county> Tartumaa </county>
| |
| <town> Tartu </town>
| |
| <street> Põllu </street>
| |
| <house_nr> 6 </house_nr>
| |
| <zip_code> 50210 </zip_code>
| |
| </address>
| |
| <address id="2">
| |
| <country> Eesti </country>
| |
| <county> Jõgevamaa </county>
| |
| <town> Palamuse </town>
| |
| <street> Oti Talu </street>
| |
| <house_nr> </house_nr>
| |
| <zip_code> 47292 </zip_code>
| |
| </address>
| |
| </addresses>
| |
| <phones default="1">
| |
| <phone type="landline" id="1"> 7249959 </phone>
| |
| <phone type="skype" id="2"></phone>
| |
| <phone type="mobile" id="3"> 53345699 </phone>
| |
| <phone type="work" id="4"></phone>
| |
| <phone type="other" id="5"></phone>
| |
| </phones>
| |
| <comments></comments>
| |
| </contact>
| |
|
| |
| <contact id="2">
| |
| <names>
| |
| <first_name> Linda </first_name>
| |
| <middle_names>
| |
| <middle_name></middle_name>
| |
| </middle_names>
| |
| <last_name> Kuusk </last_name>
| |
| </names>
| |
| <addresses default="1">
| |
| <address id="1">
| |
| <country> Eesti </country>
| |
| <county> Harjumaa </county>
| |
| <town> Tallinn </town>
| |
| <street> Akadeemia tee </street>
| |
| <house_nr> 28 </house_nr>
| |
| <zip_code> 12300 </zip_code>
| |
| </address>
| |
| </addresses>
| |
| <phones default="3">
| |
| <phone type="landline" id="1"> 6359866 </phone>
| |
| <phone type="skype" id="2"></phone>
| |
| <phone type="mobile" id="3"> 56777521 </phone>
| |
| <phone type="work" id="4"></phone>
| |
| <phone type="other" id="5"></phone>
| |
| </phones>
| |
| <comments></comments>
| |
|
| |
| </contact>
| |
| </contacts>
| |
| | |
| </pre>
| |
| | |
| === XML schema (XSD) ===
| |
| | |
| <pre>
| |
| | |
| <?xml version="1.0" encoding="utf-8"?>
| |
| <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
| |
| <xs:element name="contacts">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element maxOccurs="unbounded" name="contact">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element name="names">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element name="first_name" type="xs:string" />
| |
| <xs:element name="middle_names">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element name="middle_name" />
| |
| </xs:sequence>
| |
| </xs:complexType>
| |
| </xs:element>
| |
| <xs:element name="last_name" type="xs:string" />
| |
| </xs:sequence>
| |
| </xs:complexType>
| |
| </xs:element>
| |
| <xs:element name="addresses">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element maxOccurs="unbounded" name="address">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element name="country" type="xs:string" />
| |
| <xs:element name="county" type="xs:string" />
| |
| <xs:element name="town" type="xs:string" />
| |
| <xs:element name="street" type="xs:string" />
| |
| <xs:element name="house_nr" type="xs:string" />
| |
| <xs:element name="zip_code" type="xs:unsignedShort" />
| |
| </xs:sequence>
| |
| <xs:attribute name="id" type="xs:unsignedByte" use="required" />
| |
| </xs:complexType>
| |
| </xs:element>
| |
| </xs:sequence>
| |
| <xs:attribute name="default" type="xs:unsignedByte" use="required" />
| |
| </xs:complexType>
| |
| </xs:element>
| |
| <xs:element name="phones">
| |
| <xs:complexType>
| |
| <xs:sequence>
| |
| <xs:element maxOccurs="unbounded" name="phone">
| |
| <xs:complexType>
| |
| <xs:simpleContent>
| |
| <xs:extension base="xs:string">
| |
| <xs:attribute name="type" type="xs:string" use="required" />
| |
| <xs:attribute name="id" type="xs:unsignedByte" use="required" />
| |
| </xs:extension>
| |
| </xs:simpleContent>
| |
| </xs:complexType>
| |
| </xs:element>
| |
| </xs:sequence>
| |
| <xs:attribute name="default" type="xs:unsignedByte" use="required" />
| |
| </xs:complexType>
| |
| </xs:element>
| |
| <xs:element name="comments" />
| |
| </xs:sequence>
| |
| <xs:attribute name="id" type="xs:unsignedByte" use="required" />
| |
| </xs:complexType>
| |
| </xs:element>
| |
| </xs:sequence>
| |
| </xs:complexType>
| |
| </xs:element>
| |
| </xs:schema>
| |
| | |
| </pre>
| |
| | |
| === XSLT ===
| |
| | |
| Transformeerimine HTML formaati
| |
| | |
| <pre>
| |
| | |
| <?xml version="1.0" encoding="utf-8"?>
| |
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| |
| <xsl:template match="/">
| |
| <html>
| |
| <body>
| |
| <h2>Phone book entries (a-z)</h2>
| |
| <table border="1">
| |
| <tr bgcolor="#9acd32">
| |
| <th>Name</th>
| |
| <th>Address</th>
| |
| <th>Landline</th>
| |
| <th>Mobile phone</th>
| |
| </tr>
| |
| <xsl:for-each select="contacts/contact">
| |
| <xsl:sort select="names/first_name"/>
| |
| <tr>
| |
| <td>
| |
| <xsl:value-of select="names/first_name"/><xsl:text> </xsl:text> <!-- extra space -->
| |
| <xsl:value-of select="names/last_name"/>
| |
| </td>
| |
| <td>
| |
| <xsl:value-of select="addresses/address/country"/>,
| |
| <xsl:value-of select="addresses/address/town"/>,
| |
| <xsl:value-of select="addresses/address/street"/><xsl:text> </xsl:text> <!-- extra space -->
| |
| <xsl:value-of select="addresses/address/house_nr"/>
| |
| </td>
| |
| <td><xsl:value-of select="phones/phone[@type='landline']"/></td>
| |
| <td><xsl:value-of select="phones/phone[@type='mobile']"/></td>
| |
| </tr>
| |
| </xsl:for-each>
| |
| </table>
| |
| </body>
| |
| </html>
| |
| </xsl:template>
| |
| </xsl:stylesheet>
| |
| | |
| </pre>
| |
| | |
| | |
| XML faili formaadi muutmine
| |
| | |
| <pre>
| |
| | |
| Tulekul
| |
| | |
| </pre>
| |
| | |
| == Log ==
| |
|
| |
|
| === 03.02.2012 === | | === 03.02.2012 === |
| * XSLT lisamine wikisse. Viimased lihvimised hinde jaoks. | | * XSLT html transformatsiooni lisamine wikisse. Viimased lihvimised hinde jaoks. |
|
| |
|
| === 28.02.2012 === | | === 28.02.2012 === |