Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version = "1.0"?>
- <?xml-stylesheet type = "text/xsl" href = "1.xsl"?>
- <class>
- <student rollno="1">
- <name>q</name>
- <parentname>w</parentname>
- <branch>e</branch>
- <age>r</age>
- <address>
- <num>1</num>
- <hname>s</hname>
- </address>
- <gender>y</gender>
- </student>
- <student rollno="2">
- <name>u</name>
- <parentname>i</parentname>
- <branch>o</branch>
- <age>p</age>
- <address>
- <num>2</num>
- <hname>s</hname>
- </address>
- <gender>s</gender>
- </student>
- <student rollno="4">
- <name>d</name>
- <parentname>f</parentname>
- <branch>g</branch>
- <age>h</age>
- <address>
- <num>3</num>
- <hname>d</hname>
- </address>
- <gender>k</gender>
- </student>
- <student rollno="3">
- <name>l</name>
- <parentname>z</parentname>
- <branch>x</branch>
- <age>c</age>
- <address>
- <num>4</num>
- <hname>d</hname>
- </address>
- <gender>b</gender>
- </student>
- <student rollno="5">
- <name>n</name>
- <parentname>m</parentname>
- <branch>k</branch>
- <age>d</age>
- <address>
- <num>5</num>
- <hname>v</hname>
- </address>
- <gender>s</gender>
- </student>
- </class>
- ===================================================================================================================================================================
- <?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>
- <h2>student details </h2>
- <table border="1">
- <tr bgcolor="#9acd32">
- <th>rollno</th>
- <th>name</th>
- <th>parent</th>
- <th>branch</th>
- <th>age</th> </tr>
- <xsl:for-each select="class/student">
- <tr>
- <td>
- <!-- value-of processing instruction
- process the value of the element matching the XPath expression
- -->
- <xsl:value-of select = "@rollno"/>
- </td>
- <td><xsl:value-of select = "name"/></td>
- <td><xsl:value-of select = "parentname"/></td>
- <td><xsl:value-of select = "branch"/></td>
- <td><xsl:value-of select = "age"/></td>
- <td><xsl:value-of select = "address"/></td>
- <td><xsl:value-of select = "gender"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
- =============================================================================================================
- <!ELEMENT students(student*)>
- <!ELEMENT student (rollno,name,parentname,branch,age,gender,address )>
- <!ELEMENT rollno(#PCDATA)>
- <!ELEMENT name(#PCDATA)>
- <!ELEMENT parentname(#PCDATA)>
- <!ELEMENT branch(#PCDATA)>
- <!ELEMENT age(#PCDATA)>
- <!ELEMENT gender(#PCDATA)>
- <!ELEMENT address(#PCDATA|hname|num)>
- <!ELEMENT hname(#PCDATA)>
- <!ELEMENT num(#PCDATA)>
- <!ATTLIST student gender (female|male) "male">
Add Comment
Please, Sign In to add comment