CSE3002 – Internet and Web Programming Solved

$ 24.99
Category:

Description

CSE3002

Lab Assignment 9

ISHAAN OHRI
18BC E0265

Question:
Write a program to demonstrate the concept of data storage and parsing in XML
Develop a thesaurus tool by creating a schema for thesaurus. When a word is entered the synonyms or antonyms must be displayed based on the user request.
C ode: thesaurus.xsl

<?xml version=”1.0″?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0″>
<xsl:output method=”html”/>
<xsl:template match=”/”>
<html>
<head>
<title> thesaurus.xsl</title>
</head>
<body>
<form method=”post” action=””>
<table>
<tr>
<td>Enter word:</td>
<td><input type=”text” id=”search”/></td>
<td><input type=”submit” id=”submit” value=”Submit”/></td>
</tr>
<xsl:for-each select=”thesaurus/word”>
<xsl:if test=”@content=’Smart’”>
<tr>
<td>
<xsl:value-of select=”synonyms”/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

thesaurus.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/xsl” href=”thesaurus.xsl”?> <thesaurus>

<word content=”Beautiful”>

<synonyms>attractive, pretty, charming, pleasing, alluring</synonyms> </word>

<word content=”Dumb”>

<synonyms>stupid, dumbo</synonyms>

</word>

</thesaurus>

thesaurus.dtd

</xsl:template>

</xsl:stylesheet>

<?xml version=’1.0′ encoding=’UTF-8′?>

<!ELEMENT thesaurus (word)*>

<!ELEMENT word (synonyms)*>

<!ATTLIST word
content CDATA #IMPLIED

>

<!ELEMENT synonyms (#PCDATA)>

Output:

Question:
XSLT – Create a student mark maintenance system using XML. Create a webpage to display all the students consolidated mark statement with pass (green color) or fail (red color) using XSLT.
C ode: sr.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/xsl” href=”sr.xsl”?>
<sr>
<student>
<n>Ishaan Ohri</n>
<m>100</m>
<res>PASS-Distinction</res>
</student>
<student>
<n>Shreya Basu</n>
<m>70</m>
<res>PASS-Very Good</res>
</student>
<student>
<n>Siddhant Sharda</n>
<m>01</m>
<res>FAIL-Better luck next time</res>
</student>
<student>
<n>Gurprasad Singh</n>
<m>88</m>
<res>PASS-Very good ,keep it up</res>
</student>
<student>
<n>Shivam Anand</n>
<m>33</m>
<res>FAIL-Better luck next time</res>
</student>
<student>
<n>Sameer Rupani</n>
<m>80</m>
<res>PASS-Very good ,keep it up</res>
</student>
<student>
<n>Rupin Singh</n>
<m>78</m>
<res>PASS-Very Good</res>
</student>
<student>
<n>Riya</n>
<m>50</m>
<res>PASS- Can do better</res>
</student>
</sr>

sr.xsl

<?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>
<h1 align=”center”> STUDENTS’ RESULT RECORD</h1>
<table border=”4″ align=”center” width=”500px” height=”400px”>
<tr>
<th>Name</th>
<th>Marks</th>
<th>Result</th>
</tr>
<xsl:for-each select=”sr/student”>
<xsl:if test = “m > 40”>
<tr bgcolor = “green” align=”center”>
<td><xsl:value-of select=”n”/></td>
<td><xsl:value-of select=”m”/></td>
<td><xsl:value-of select=”res”/></td>
</tr>
</xsl:if>
<xsl:if test = “m &lt; 40”>
<tr bgcolor = “red” align=”center”>
<td><xsl:value-of select=”n”/></td>
<td><xsl:value-of select=”m”/></td>
<td><xsl:value-of select=”res”/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Output:

Reviews

There are no reviews yet.

Be the first to review “CSE3002 – Internet and Web Programming Solved”

Your email address will not be published. Required fields are marked *