IT: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 161: | Line 161: | ||
</xs:schema> | </xs:schema> | ||
</pre> | </pre> | ||
===XSL failid=== | ===XSL failid=== | ||
Otsitake välja kõik Triinu püütud kalad. | |||
<pre> | |||
<?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></head> | |||
<body> | |||
<table> | |||
<tr> | |||
<th>Triinu kalad</th> | |||
</tr> | |||
<xsl:for-each select="fishes/fish[catchingInfo/person[string(.)='Triin']]"> | |||
<tr> | |||
<td>Kala:</td> | |||
<td> | |||
<xsl:value-of select="fishInfo/species"/> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Püügikuupäev:</td> | |||
<td> | |||
<xsl:value-of select="catchingInfo/date"/> | |||
</td> | |||
</tr> | |||
</xsl:for-each> | |||
</table> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</pre> | |||
Otsitakse välja kõik püütud haugid. | |||
<pre> | |||
<?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></head> | |||
<body> | |||
<table> | |||
<tr> | |||
<th>Püütud haugid</th> | |||
</tr> | |||
<xsl:for-each select="fishes/fish[fishInfo/species[string(.)='Haug']]"> | |||
<tr> | |||
<td>Püüdja:</td> | |||
<td> | |||
<xsl:value-of select="catchingInfo/person"/> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Püügikuupäev:</td> | |||
<td> | |||
<xsl:value-of select="catchingInfo/date"/> | |||
</td> | |||
</tr> | |||
</xsl:for-each> | |||
</table> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</pre> | |||
==Esimene XML-i retsensioon == | ==Esimene XML-i retsensioon == |
Revision as of 13:04, 28 March 2015
Meeskonna liikmed
- Triin Soosalu
- Imre Padonik
XML andmefailid
Järgnevad XML kodutöö failid on alla laetavad siit.
XML andmefail
<?xml version="1.0" encoding="utf-8" ?> <fishes> <fish id="1"> <fishInfo> <species speciesId="1"><![CDATA[Haug]]></species> <size type="weigth" unit="g">1700</size> <size type="length" unit="cm">68</size> </fishInfo> <catchingInfo> <date>2014-12-03</date> <person personId="3"><![CDATA[Imre]]></person> <gearKit> <gear type="rod" size="2700" unit="cm"><![CDATA[DIAMOND JIG SPIN 270]]></gear> <gear type="reel" size="4000" unit="reel"><![CDATA[CATANA 4000RB]]></gear> <gear type="line" size="0.22" unit="mm"><![CDATA[Tamiil]]></gear> <gear type="bait" size="20" unit="g"><![CDATA[Lant]]></gear> </gearKit> </catchingInfo> </fish> <fish id="2"> <fishInfo> <species speciesId="2"><![CDATA[Kilu]]></species> <size type="weigth" unit="g">40</size> <size type="length" unit="cm">7</size> </fishInfo> <catchingInfo> <date>2015-02-03</date> <person personId="2"><![CDATA[Triin]]></person> <gearKit> <gear type="rod" size="240" unit="cm"><![CDATA[DIAMOND JIG SPIN 240]]></gear> <gear type="reel" size="2500" unit="reel"><![CDATA[SAHARA 2500FE]]></gear> <gear type="line" size="0.02" unit="mm"><![CDATA[Tamiil]]></gear> <gear type="bait" size="1" unit="nr"><![CDATA[Uss]]></gear> </gearKit> </catchingInfo> </fish> <fish id="3"> <fishInfo> <species speciesId="3"><![CDATA[Jõeforell]]></species> <size type="weigth" unit="g">1200</size> <size type="length" unit="cm">59</size> </fishInfo> <catchingInfo> <date>2015-01-31</date> <person personId="2"><![CDATA[Triin]]></person> <gearKit> <gear type="rod" size="240" unit="cm"><![CDATA[DIAMOND JIG SPIN 240]]></gear> <gear type="reel" size="3000" unit="reel"><![CDATA[CATANA 3000SRB]]></gear> <gear type="line" size="0.18" unit="mm"><![CDATA[Nöör]]></gear> <gear type="bait" size="15" unit="g"><![CDATA[Lant]]></gear> </gearKit> </catchingInfo> </fish> <fish id="4"> <fishInfo> <species speciesId="4"><![CDATA[Delfiin]]></species> <size type="weigth" unit="g">120000</size> <size type="length" unit="cm">2103</size> </fishInfo> <catchingInfo> <date>2014-11-09</date> <person personId="3"><![CDATA[Imre]]></person> <gearKit> <gear type="rod" size="300" unit="cm"><![CDATA[DIAMOND JIG SPIN 300]]></gear> <gear type="reel" size="4000" unit="reel"><![CDATA[CATANA 4000RB]]></gear> <gear type="line" size="4.5" unit="mm"><![CDATA[Köis]]></gear> <gear type="bait" size="3000" unit="g"><![CDATA[Kilpkonn]]></gear> </gearKit> </catchingInfo> </fish> </fishes>
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="fishes"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="fish"> <xs:complexType> <xs:sequence> <xs:element name="fishInfo"> <xs:complexType> <xs:sequence> <xs:element name="species"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="speciesId" type="xs:unsignedInt" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element maxOccurs="unbounded" name="size"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:unsignedInt"> <xs:attribute name="type" type="xs:string"/> <xs:attribute name="unit" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="catchingInfo"> <xs:complexType> <xs:sequence> <xs:element name="date" type="xs:date" /> <xs:element name="person"> <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="gearKit"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="gear"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="type" type="xs:string"/> <xs:attribute name="size" type="xs:decimal"/> <xs:attribute name="unit" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:unsignedInt" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
XSL failid
Otsitake välja kõik Triinu püütud kalad.
<?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></head> <body> <table> <tr> <th>Triinu kalad</th> </tr> <xsl:for-each select="fishes/fish[catchingInfo/person[string(.)='Triin']]"> <tr> <td>Kala:</td> <td> <xsl:value-of select="fishInfo/species"/> </td> </tr> <tr> <td>Püügikuupäev:</td> <td> <xsl:value-of select="catchingInfo/date"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Otsitakse välja kõik püütud haugid.
<?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></head> <body> <table> <tr> <th>Püütud haugid</th> </tr> <xsl:for-each select="fishes/fish[fishInfo/species[string(.)='Haug']]"> <tr> <td>Püüdja:</td> <td> <xsl:value-of select="catchingInfo/person"/> </td> </tr> <tr> <td>Püügikuupäev:</td> <td> <xsl:value-of select="catchingInfo/date"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Esimene XML-i retsensioon
Retsensioon meeskonnale "...". Meeskonna "..." XML failid asuvad [ siin.]
Teine XML-i retsensioon
Retsensioon meeskonnale "...". Meeskonna "..." XML failid asuvad [ siin.]