0% found this document useful (0 votes)
40 views

Ex-4 XML For Creation of DTD, Which Specifies Set of Rules. Create A Style Sheet in CSS/ XSL & Display The Document

Uploaded by

Desmond Krej
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Ex-4 XML For Creation of DTD, Which Specifies Set of Rules. Create A Style Sheet in CSS/ XSL & Display The Document

Uploaded by

Desmond Krej
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ex-4 XML for creation of DTD, which specifies set

of
rules. Create a style sheet in CSS/ XSL & display
the document

student.xml

<?xml version="1.0" encoding="UTF- <TotalMarks>500</TotalMarks>


8"?> <Percentage>76</Percentage>
<?xml-stylesheet type="text/xsl" </Student>
href="students.xsl"?> <Student>
<!DOCTYPE Students SYSTEM <RollNo>108</RollNo>
"students.dtd"> <Marks>320</Marks>
<Students> <TotalMarks>500</TotalMarks>
<Percentage>64</Percentage>
<Student> </Student>
<RollNo>101</RollNo> <Student>
<Marks>450</Marks> <RollNo>109</RollNo>
<TotalMarks>500</TotalMarks> <Marks>290</Marks>
<Percentage>90</Percentage> <TotalMarks>500</TotalMarks>
</Student> <Percentage>58</Percentage>
<Student> </Student>
<RollNo>102</RollNo> <Student>
<Marks>400</Marks> <RollNo>110</RollNo>
<TotalMarks>500</TotalMarks> <Marks>470</Marks>
<Percentage>80</Percentage> <TotalMarks>500</TotalMarks>
</Student> <Percentage>94</Percentage>
<Student> </Student>
<RollNo>103</RollNo> </Students>
<Marks>350</Marks>
<TotalMarks>500</TotalMarks>
<Percentage>70</Percentage> student.dtd
</Student>
<Student>
<RollNo>104</RollNo> <!ELEMENT Students (Student+)>
<Marks>300</Marks> <!ELEMENT Student (RollNo,
<TotalMarks>500</TotalMarks> Marks, TotalMarks, Percentage)>
<Percentage>60</Percentage> <!ELEMENT RollNo (#PCDATA)>
</Student> <!ELEMENT Marks (#PCDATA)>
<Student> <!ELEMENT TotalMarks (#PCDATA)>
<RollNo>105</RollNo> <!ELEMENT Percentage
<Marks>475</Marks> (#PCDATA)>
<TotalMarks>500</TotalMarks>
<Percentage>95</Percentage>
</Student>
<Student>
<RollNo>106</RollNo>
<Marks>425</Marks>
<TotalMarks>500</TotalMarks>
<Percentage>85</Percentage>
</Student>
<Student>
<RollNo>107</RollNo>
<Marks>380</Marks>
student.xsl
<body>
<?xml version="1.0" <h2>Student Details</h2>
encoding="UTF-8"?> <table>
<xsl:stylesheet version="1.0" <tr>
xmlns:xsl="http://www.w3.org/1999 <th>Roll No</th>
/XSL/Transform"> <th>Marks</th>
<th>Total Marks</th>
<xsl:template match="/"> <th>Percentage</th>
<html> </tr>
<head> <xsl:for-each
<title>Student Details</title> select="Students/Student">
<style> <tr>
table { <td><xsl:value-of
width: 50%; select="RollNo"/></td>
border-collapse: collapse; <td><xsl:value-of
margin: 20px 0; select="Marks"/></td>
font-family: Arial, sans- <td><xsl:value-of
serif; select="TotalMarks"/></td>
} <td><xsl:value-of
table, th, td { select="Percentage"/></td>
border: 1px solid black; </tr>
} </xsl:for-each>
th, td { </table>
padding: 10px; </body>
text-align: left; </html>
} </xsl:template>
th {
background-color: #f2f2f2; </xsl:stylesheet>
}
</style>
</head>

OUTPUT

You might also like