joelnazarene

Untitled

Mar 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. <?xml version = "1.0"?>
  2. <?xml-stylesheet type = "text/xsl" href = "1.xsl"?>
  3.  
  4. <class>
  5. <student rollno="1">
  6. <name>q</name>
  7. <parentname>w</parentname>
  8. <branch>e</branch>
  9. <age>r</age>
  10. <address>
  11. <num>1</num>
  12. <hname>s</hname>
  13. </address>
  14. <gender>y</gender>
  15. </student>
  16.  
  17.  
  18.  
  19. <student rollno="2">
  20. <name>u</name>
  21. <parentname>i</parentname>
  22. <branch>o</branch>
  23. <age>p</age>
  24. <address>
  25. <num>2</num>
  26. <hname>s</hname>
  27. </address>
  28. <gender>s</gender>
  29. </student>
  30.  
  31.  
  32.  
  33.  
  34. <student rollno="4">
  35. <name>d</name>
  36. <parentname>f</parentname>
  37. <branch>g</branch>
  38. <age>h</age>
  39. <address>
  40. <num>3</num>
  41. <hname>d</hname>
  42. </address>
  43. <gender>k</gender>
  44. </student>
  45.  
  46.  
  47.  
  48. <student rollno="3">
  49. <name>l</name>
  50. <parentname>z</parentname>
  51. <branch>x</branch>
  52. <age>c</age>
  53. <address>
  54. <num>4</num>
  55. <hname>d</hname>
  56. </address>
  57. <gender>b</gender>
  58. </student>
  59.  
  60.  
  61.  
  62. <student rollno="5">
  63. <name>n</name>
  64. <parentname>m</parentname>
  65. <branch>k</branch>
  66. <age>d</age>
  67. <address>
  68. <num>5</num>
  69. <hname>v</hname>
  70. </address>
  71. <gender>s</gender>
  72. </student>
  73. </class>
  74. ===================================================================================================================================================================
  75. <?xml version="1.0" encoding="UTF-8"?>
  76. <xsl:stylesheet version="1.0"
  77. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  78. <xsl:template match="/">
  79. <html>
  80. <body>
  81. <h2>student details </h2>
  82. <table border="1">
  83. <tr bgcolor="#9acd32">
  84. <th>rollno</th>
  85. <th>name</th>
  86. <th>parent</th>
  87. <th>branch</th>
  88. <th>age</th> </tr>
  89. <xsl:for-each select="class/student">
  90. <tr>
  91. <td>
  92. <!-- value-of processing instruction
  93. process the value of the element matching the XPath expression
  94. -->
  95. <xsl:value-of select = "@rollno"/>
  96. </td>
  97.  
  98. <td><xsl:value-of select = "name"/></td>
  99. <td><xsl:value-of select = "parentname"/></td>
  100. <td><xsl:value-of select = "branch"/></td>
  101. <td><xsl:value-of select = "age"/></td>
  102. <td><xsl:value-of select = "address"/></td>
  103. <td><xsl:value-of select = "gender"/></td>
  104. </tr>
  105. </xsl:for-each>
  106. </table>
  107. </body>
  108. </html>
  109. </xsl:template>
  110. </xsl:stylesheet>
  111.  
  112. =============================================================================================================
  113. <!ELEMENT students(student*)>
  114. <!ELEMENT student (rollno,name,parentname,branch,age,gender,address )>
  115. <!ELEMENT rollno(#PCDATA)>
  116. <!ELEMENT name(#PCDATA)>
  117. <!ELEMENT parentname(#PCDATA)>
  118. <!ELEMENT branch(#PCDATA)>
  119. <!ELEMENT age(#PCDATA)>
  120. <!ELEMENT gender(#PCDATA)>
  121. <!ELEMENT address(#PCDATA|hname|num)>
  122. <!ELEMENT hname(#PCDATA)>
  123. <!ELEMENT num(#PCDATA)>
  124. <!ATTLIST student gender (female|male) "male">
Add Comment
Please, Sign In to add comment