Wtexp 3
Wtexp 3
Aim: Design the XMI. document to store the information of the employees of any business organization and
demonstrate the use of:
a) DTD
b) XML Schema
Code:
employees.xml
<employees>
<employee>
<id>101</id>
<name>John Doe</name>
<position>Software Engineer</position>
<department>IT</department>
<salary>70000</salary>
<joiningDate>2020-01-15</joiningDate>
</employee>
<employee>
<id>102</id>
<name>Jane Smith</name>
<position>Project Manager</position>
<department>Operations</department>
<salary>95000</salary>
<joiningDate>2018-05-25</joiningDate>
</employee>
<employee>
<id>103</id>
<name>Tom Brown</name>
<position>HR Executive</position>
<department>Human Resources</department>
<salary>50000</salary>
<joiningDate>2021-03-10</joiningDate>
</employee>
</employees>
-----------------------------------------------------------------------------------------------------------------
employees.xsl
<xsl:template match="/">
<html>
<head>
<title>Employee Information</title>
<style>
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>Employee List</h2>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Position</th>
<th>Department</th>
<th>Salary</th>
<th>Joining Date</th>
</tr>
<xsl:for-each select="employees/employee">
<tr>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="position"/></td>
<td><xsl:value-of select="department"/></td>
<td><xsl:value-of select="salary"/></td>
<td><xsl:value-of select="joiningDate"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------------------------------------------------------
employees.dtd
------------------------------------------------------------------------------------------------------
employees.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employees">
<xs:complexType>
<xs:sequence>
<xs:complexType>
<xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-----------------------------------------------------------------------------------------------------------------
Output: