Thursday, April 12, 2012

Displaying student details using XML and XSLT


DISPLAYING STUDENT DETAILS USING XML AND XSLT

ALGORITHM:

1.      Create an XML document (stud.xml) that contains the markup tags such as <name>, <dept>, and <rno>.
2.      Create an XSL document (stud.xsl) that defines the style to display an XML document.
3.      Associate style sheet (XSL) with XML using the markup <?xml-stylesheet>
4.      Load the XML document (stud.xml) in the browser.

stud.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stud.xsl"?>
<studInfo>
<stud>
<name>Abhilash</name>
<dept>IT</dept>
<rno>97709205001</rno>
</stud>
<stud>
<name>Akhila</name>
<dept>IT</dept>
<rno>97709205002</rno>
</stud>
<stud>
<name>Anaswara</name>
<dept>IT</dept>
<rno>97709205003</rno>
</stud>
</studInfo>
stud.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Details - Transformation</title>
</head>
<body>
<table border="1">
<caption>Student Details</caption>
<tr>
<th>Name</th><th>Department</th><th>Register No</th>
</tr>
<xsl:for-each select="/studInfo/stud">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="dept"/></td>
<td><xsl:value-of select="rno"/></td>
</tr>
</xsl:for-each>
</table>
</body>   
 </html>    
</xsl:template>    
</xsl:transform>

OUTPUT SCREENSHOTS



6 comments:

  1. In which app did u put this prgm??
    And how did you run the program

    ReplyDelete
  2. Pls send the DTD AND XML Schema for that

    ReplyDelete
  3. Pls send DTD and XML Schema for that

    ReplyDelete
  4. ohoo CAT 3 question hai aa raha hai kal exam me

    ReplyDelete
  5. Thank You and that i have a swell provide: Renovation House Company home renovation victoria

    ReplyDelete