Meeskond:MS-TO
From ICO wiki
MS-TO
Meeskonna liikmed
- Margus Roo
- Silja Saar
- Tõnis Luik
- Ott Kingisepp
XML andmefail
XML fail
<?xml version="1.0" encoding="UTF-8" ?> <people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com people.xsd"> <person id="37303140314" age="41" sex="M"> <fname><![CDATA[Margus]]></fname> <lname><![CDATA[Roo]]></lname> <email><![CDATA[margus@roo.ee]]></email> <phones> <phone status="active" number="+3725148780"/> <phone status="active" number="+3725148781"/> <phone status="unactive" number="+3725148784"/> </phones> </person> <person age="31" sex="M" id="38209064511"> <fname><![CDATA[Tõnis]]></fname> <lname><![CDATA[Luik]]></lname> <email><![CDATA[tonisluik@hotmail.com]]></email> <phones> <phone status="active" number="+3725148786"/> <phone status="active" number="+3725148787"/> <phone status="unactive" number="+3725148788"/> </phones> </person> <person age="32" sex="F" id="48209064522"> <fname><![CDATA[Silja]]></fname> <lname><![CDATA[Saar]]></lname> <email><![CDATA[silja.saar@live.com]]></email> <phones> <phone status="active" number="+3725148111"/> <phone status="active" number="+3725148222"/> <phone status="unactive" number="+3725148333"/> </phones> </person> <person age="32" sex="M" id="38209164533"> <fname><![CDATA[Ott]]></fname> <lname><![CDATA[Kingisepp]]></lname> <email><![CDATA[ott.kingisepp@gmail.com]]></email> <phones> <phone status="active" number="+3725118711"/> <phone status="active" number="+3725128722"/> <phone status="unactive" number="+3725128733"/> </phones> </person> </people>
XML skeemifail
<?xml version = "1.0" encoding = "UTF-8"?> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"> <xsd:element name = "people"> <xsd:complexType> <xsd:sequence> <xsd:element ref = "person " maxOccurs = "unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="fname" type="xs:string"/> <xs:element name="lname" type="xs:string"/> <xs:element name="email" type="xs:string"/> <xs:element name="phone"> <xs:complexType> <xs:sequence> <xs:element name="number" type="xs:string"/> </xs:sequence> <xs:attribute name="status " type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:int" use="required"/> <xs:attribute name="age" type="xs:int" use="required"/> <xs:attribute name="sex" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:schema>
XSLT failid
HTML [1]
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/" > <htm> <head> <title>Persons database</title> </head> <body> <xsl:for-each select="people/person"> <p><xsl:value-of select="concat(position(),' - ',fname,' ',lname)"/></p> <p>ID: <xsl:value-of select="@id"/></p> <p>Age: <xsl:value-of select="@age"/></p> <p>Sex: <xsl:value-of select="@sex"/></p> <p>Phones</p> <xsl:for-each select="phones/phone"> <p><xsl:value-of select="@number"/></p> </xsl:for-each> <hr/> </xsl:for-each> </body> </htm> </xsl:template> </xsl:stylesheet>
HTML 2
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/" > <htm> <head> <title>Persons database</title> </head> <body> <h2> Meesterahvad </h2> <table border='1'> <tr bgcolor="#BFBFBF"> <th>Eesnimi</th> <th>Perenimi</th> <th>Sugu</th> </tr> <xsl:for-each select="/people/person[starts-with(@id, '3')]"> <xsl:sort select="lname" order="ascending" /> <tr> <td><xsl:value-of select="fname"/></td> <td><xsl:value-of select="lname"/></td> <td><xsl:value-of select="@sex"/></td> </tr> </xsl:for-each> </table> </body> </htm> </xsl:template> </xsl:stylesheet>