Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
  4. >
  5. <xsl:output method="html" indent="yes"/>
  6.  
  7. <xsl:template match="/">
  8.  
  9. <html>
  10. <head>
  11. <meta charset="UTF-8" />
  12. <title>Hypertext &amp; hypermedia</title>
  13. <link rel="stylesheet" href="index.css" />
  14. </head>
  15. <body>
  16. <div id="wrapper">
  17. <header>
  18. <h1>Hypertext hypermedia</h1>
  19.  
  20. <!-- wywołanie szablonu pozwalającego na wyświetlenie obrazków z logo -->
  21. <xsl:apply-templates select="course/information/media/image"/>
  22. </header>
  23.  
  24. <!-- menu do poruszania w obrębie strony -->
  25. <xsl:call-template name="menu"/>
  26.  
  27. <div id="content">
  28. <!-- a place for information about lecture, laboratory, project and links -->
  29. <h3 id="lecture">Lecture</h3>
  30. <p>
  31. Information about the lecture.
  32. </p>
  33. <!-- wyświetlenie informacji dotyczących wykładu -->
  34. <xsl:for-each select="course/study[@kind='lecture']/activities/range/component">
  35.  
  36. <xsl:sort select="."/>
  37. <xsl:number value="position()"/>
  38. <xsl:text>. </xsl:text>
  39. <xsl:value-of select="."/>
  40. <br></br>
  41. </xsl:for-each>
  42. <!-- wywołanie szablonu pozwalającego na wyświetlenie informacji dotyczących laboratorium -->
  43. <xsl:apply-templates select="course/study[@kind='laboratory']"/>
  44. <!-- wywołanie szablonu pozwalającego na wyświetlenie informacji dotyczących projektu -->
  45. <xsl:apply-templates select="course/study[@kind='project']"/>
  46. <h3 id="links">Additional information about HTML and XML</h3>
  47. <ul>
  48. <!-- wywołanie szablonu pozwalającego na wyświetlenie linków -->
  49. <xsl:apply-templates select="course/information/links/link[3 > position()]"/>
  50. </ul>
  51.  
  52. </div>
  53. <!-- end content -->
  54. <footer>
  55. <xsl:apply-templates select="course/author"/> <!-- wywołanie szablonu pozwalającego na wyświetlenie informacji o imieniu oraz nazwisku studenta -->
  56. </footer>
  57. </div>
  58. <!-- end wrapper -->
  59. </body>
  60. </html>
  61.  
  62. </xsl:template>
  63.  
  64. <xsl:template match="study[@kind='laboratory']">
  65. <h3 id="{@kind}">Laboratory</h3>
  66. <p>
  67. Information about the laboratory.
  68. </p>
  69. <ol>
  70. <xsl:apply-templates select="activities"/>
  71. </ol>
  72. </xsl:template>
  73.  
  74. <xsl:template match="study[@kind='project']">
  75. <h3 id="{@kind}">Project</h3>
  76. <p>
  77. Information about the project.
  78. </p>
  79. <table style="width:50%; border: 5px solid red">
  80. <tr>
  81. <th>Title of the project</th>
  82. <th>Score</th>
  83. </tr>
  84. <xsl:apply-templates select="activities"/>
  85. </table>
  86. <!--
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. </table>
  94. -->
  95. </xsl:template>
  96. <xsl:template match="study[@kind='project']/activities">
  97. <tr>
  98. <td>
  99. <xsl:value-of select="topic"/>
  100. </td>
  101. <td>
  102. <xsl:value-of select="score"/>
  103. </td>
  104. </tr>
  105. </xsl:template>
  106.  
  107.  
  108. <xsl:template match="activities">
  109. <li>
  110. <xsl:value-of select="topic"/>
  111. </li>
  112. <ul>
  113. <xsl:apply-templates select="range/component"/>
  114. </ul>
  115. </xsl:template>
  116.  
  117. <xsl:template match="component">
  118. <li>
  119. <xsl:value-of select="."/>
  120. </li>
  121. </xsl:template>
  122.  
  123. <xsl:template match="image">
  124. <xsl:choose>
  125. <xsl:when test="contains(.,'ETI')">
  126. <img src="{@source}" class="right"></img>
  127. </xsl:when>
  128. <xsl:when test="contains(.,'PG')">
  129. <img src="{@source}" class="left"></img>
  130. </xsl:when>
  131. </xsl:choose>
  132. </xsl:template>
  133.  
  134. <xsl:template match="link">
  135. <li>
  136. <a href="{@source}">
  137. <xsl:value-of select="."/>
  138. </a>
  139. </li>
  140. </xsl:template>
  141.  
  142. <xsl:template match="course/author">
  143. Copyright 2018,<xsl:value-of select="name"/> <xsl:value-of select="surname"/> , 31-10-2018
  144. </xsl:template>
  145.  
  146. <xsl:template name="menu">
  147. <nav id="in_menu">
  148. <dl>
  149. <dt>HiH</dt>
  150. <dd>
  151. <a href="#lecture">Lecture</a>
  152. </dd>
  153. <dd>
  154. <a href="#lab">Laboratory</a>
  155. </dd>
  156. <dd>
  157. <a href="#project">Project</a>
  158. </dd>
  159. <dd>
  160. <a href="#links">Links</a>
  161. </dd>
  162. </dl>
  163. </nav>
  164. <!--
  165. <nav id="in_menu">
  166. <dl>
  167. <dt>HiH</dt>
  168. <dd>
  169. <a href="#lecture">Lecture</a>
  170. </dd>
  171. <dd>
  172. <a href="#lab">Laboratory</a>
  173. </dd>
  174. <dd>
  175. <a href="#project">Project</a>
  176. </dd>
  177. <dd>
  178. <a href="#links">Links</a>
  179. </dd>
  180. </dl>
  181. </nav>
  182. -->
  183. </xsl:template>
  184.  
  185. <!--
  186. <h3 id="lab">Laboratory</h3>
  187. <p>
  188. Information about the laboratory.
  189. </p>
  190. <ol>
  191. <li>HTML + CSS</li>
  192. <ul>
  193. <li>structure of the page </li>
  194. <li>links </li>
  195. <li>forms </li>
  196. <li>css </li>
  197. </ul>
  198.  
  199. </ol>
  200. -->
  201. <!--
  202. <h3 id="project">Project</h3>
  203. <p>
  204. Information about the project.
  205. </p>
  206.  
  207. <table style="width:50%; border: 5px solid red">
  208. <tr>
  209. <th>Title of the project</th>
  210. <th>Score</th>
  211. </tr>
  212.  
  213. </table>
  214. -->
  215.  
  216. <!--
  217. <nav id="in_menu">
  218. <dl>
  219. <dt>HiH</dt>
  220. <dd>
  221. <a href="#lecture">Lecture</a>
  222. </dd>
  223. <dd>
  224. <a href="#lab">Laboratory</a>
  225. </dd>
  226. <dd>
  227. <a href="#project">Project</a>
  228. </dd>
  229. <dd>
  230. <a href="#links">Links</a>
  231. </dd>
  232. </dl>
  233. </nav>
  234. -->
  235.  
  236.  
  237. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement